0
votes

I have a Wordpress 4.2.2 site setup on Nginx. I have installed iThemes Security plugin version 5.3.5.

I have changed the login slug to something new. When i try accessing the backend via wp-admin it redirects to not_found - fine.

If I use my new slug it shows the login form, when I submit the form I am redirected to the sites frontend homepage, not the admin.

If i then type /wp-admin whilst logged in, I can see the admin fine. Is this correct, should it not go straight to the dashboard? When I click logout, the page gotos 'not_found' again, but does log me out successfully.

1
Disabling the bbpress plugin appears to fix this issue. Any ideas how to get them to work together?Charlie Stelling

1 Answers

1
votes

It's due the redirection by bbPress. You can add this code to your theme's functions.php:

  add_filter('bbp_redirect_login', 'custom_bbp_redirect_login', 10, 3);
  function custom_bbp_redirect_login($url, $raw_url, $user){
    if ( !empty($user) && !empty($user->roles) && (in_array( 'administrator', (array)$user->roles ) || in_array( 'editor', (array)$user->roles )) ) {
      return get_admin_url();
    } 
    return $url;
  }

Code above checks if user have admin or editor role and then redirects these users to wp-admin. You should edit that to fit to your needs.

For logouts you may just use this code in your functions.php to remove redirecting from bbPress:

remove_filter('logout_url', 'bbp_logout_url', 2);