wp_authenticate redirects
-
Hello all,
I’m trying to use wp_authenticate to authenticate users using WordPress credentials on an external PHP application. My code is as follows:
function authenticate($user,$password) { $auth = wp_authenticate($user, $password); if(is_wp_error($auth)) { return false; } else { return true; } }
I require wp-blog-header.php to access WordPress functions, as follows:
require("/path/to/wordpress/wp-blog-header.php");
On a successful authentication, the function should return true, and a separate part of the script should redirect to a new (non-wordpress) page. On an unsuccessful authentication, the script should just reload the login page.
If incorrect credentials are used, and the function returns false, everthing seems to work fine (the login screen is reloaded).
However, if the correct credentials are entered, the script redirects to WordPress’ wp-login.php page, and asks me to login again – but the session variable that my script uses to check if a user has logged in does seem to be set.
Why does wp_authenticate redirect to the wp-login.php page, and is there any way to stop it doing this?
Thanks,
Ben.
- The topic ‘wp_authenticate redirects’ is closed to new replies.