Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wp-user-manager/24be5c9c96d4d7e3b7dbb8a01e6d3234 to your computer and use it in GitHub Desktop.
Save wp-user-manager/24be5c9c96d4d7e3b7dbb8a01e6d3234 to your computer and use it in GitHub Desktop.
WP User Manager - Redirect the login and register pages for logged in users to the account page
<?php
add_action( 'template_redirect', 'wpum_logged_in_login_redirect' );
function wpum_logged_in_login_redirect() {
if ( ! is_user_logged_in() ) {
return;
}
if ( is_page( wpum_get_core_page_id( 'login' ) ) || is_page( wpum_get_core_page_id( 'register' ) ) ) {
wp_redirect( get_permalink( wpum_get_core_page_id( 'account' ) ) );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment