"Connect with Facebook" stalling
-
I wanted to raise a problem I ran into (made for myself) and share the solution – just in case someone else is experiencing something similar.
Also I want to ask a related question.
So, first, after everything working just as expected with Facebook Login, something happened to stall the login process. When selecting “Connect with Facebook” on the login page, the process stalled with the the Ajax spinner spinning. Firebug in Firefox, showed a 302 error with moved temporary redirection on admin-ajax.php:
https://<server>/wp-admin/admin-ajax.php 302 Moved Temporarily
To make a long story short, after a lot of hunting around and head scratching, I found this thread showing an admin init hook used to block WP admin pages from non-admins can cause the problem. Sure enough I’d recently added the code below to my function.php file, thinking I’d improve the security of the site:
function rkk_redirect_admin(){ if ( !current_user_can( 'edit_posts' ) ){ wp_redirect( site_url() ); exit; } } add_action( 'admin_init', 'rkk_redirect_admin' );
Once I removed this, Facebook Login started working again and the 302 error disappeared.
So, I guess if you’re having problems with a stalled login process, it’s worth checking the errors and checking whether a plugin or something you’ve done is blocking the admin backend.
Finally, is there a way Facebook Login could access ajax without access to admin? Alternatively, I wonder whether there’s a way to block non-admin access to WP admin pages, and still use plugins like Facebook Login?
- The topic ‘"Connect with Facebook" stalling’ is closed to new replies.