Skip to content

Instantly share code, notes, and snippets.

@mennwebs
Created July 24, 2017 14:29
Show Gist options
  • Save mennwebs/3990546ddf0ee5210dfa480009fafd8d to your computer and use it in GitHub Desktop.
Save mennwebs/3990546ddf0ee5210dfa480009fafd8d to your computer and use it in GitHub Desktop.
WordPress - Redirect Login to /account/ page
<?php
function seed_login_redirect(){
global $pagenow;
if('wp-login.php' == $pagenow) {
if(isset($_POST['wp-submit']) || // in case of LOGIN
(isset($_GET['action']) && $_GET['action']=='logout') || // in case of LOGOUT
(isset($_GET['checkemail']) && $_GET['checkemail']=='confirm') || // in case of LOST PASSWORD
(isset($_GET['checkemail']) && $_GET['checkemail']=='registered')) return; // in case of REGISTER
else wp_redirect(home_url('/account/')); // or wp_redirect(home_url('/login'));
exit();
}
}
add_action('init','seed_login_redirect');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment