I’m having a problem with the login form for a site I’ve inherited, wherein only certain users are sent to the correct page after logging in. On this site, users with accounts are allowed into a special area. These accounts are all normal WordPress user accounts with very limited access.
In order to access this special area of the site, users must use a login form. The login form appears to be based on this code for customizing the wp-admin login:
if ( ! is_user_logged_in() ) { // Display WordPress login form:
$args = array(
'redirect' => admin_url(),
'form_id' => 'loginform-custom',
'label_username' => __( 'Username custom text' ),
'label_password' => __( 'Password custom text' ),
'label_remember' => __( 'Remember Me custom text' ),
'label_log_in' => __( 'Log In custom text' ),
'remember' => true
);
wp_login_form( $args );
} else { // If logged in:
wp_loginout( home_url() ); // Display "Log Out" link.
echo " | ";
wp_register('', ''); // Display "Site Admin" link.
}
from this page: https://codex.wordpress.org/Customizing_the_Login_Form
Just about everything works as you would expect. If you’re already logged in and click our login link, you’re kicked to /foo/
. Problem is: if you’re not already logged in, upon logging in you’re still kicked to /foo/bar/
. However, administrator accounts who log in here are correctly kicked to /foo/
.
So far, I’ve run grep -rl "/foor/bar" /wordpress/site/path
to find any remaining references to this path, but they are all just buttons and hyperlinks. I’m fairly new at this; is there something obvious I’m missing?
I’d check that the login_redirect filter isn’t being used in your functions.php file. If a search for the ‘/foo/bar’ path in your theme doesn’t return any results, a plugin like Peter’s Login Redirect could be being used and would likely store the path in the database.