Redirect from wp-login.php with add_action?
-
Hey gang, I have a community website with multiple users, and I’m the only administrator. They do all of their postings, etc… through a front end I’ve built into my theme, and for security as well as visual continuity, I block them from any of the dashboard/wp-admin sections. I’m able to do this in my functions thisaway:
if(!(current_user_can('update_core'))) { add_action('admin_menu', 'hide_admin'); }; function hide_admin() { header('Location: http://www.mywebsite.com); }
This is all well and good, but the problem comes when they enter their login credentials through the site. If they enter incorrectly, and when they log out, they are redirected to wp-login.php.
My unhappy solution has been to manually edit the wp-login.php to insert code that basically says to display nothing, store any error messages from an incorrect login to a $_SESSION variable, and then bounce back to the referring page and display there.
I hate having to redo it after updates and am trying to straighten up and take the narrow road of only coding the theme. But it doesn’t look like any add_actions can help me here. Thoughts? Not interested in plugins.
- The topic ‘Redirect from wp-login.php with add_action?’ is closed to new replies.