Created
December 6, 2020 09:42
-
-
Save rupokify/8e609485e1f85f89a7423f9afd56ddb2 to your computer and use it in GitHub Desktop.
Redirect Logged In Users From Front Page to Another Page WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Redirect Logged-in users from front page to another page | |
function my_logged_in_redirect() { | |
if (is_front_page() && is_user_logged_in()) { | |
// Replace "YOUR_URL_HERE" with your target URL | |
wp_redirect( 'YOUR_URL_HERE', 301 ); | |
exit; | |
} | |
} | |
add_action( 'template_redirect', 'my_logged_in_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment