Answers for "wordpress redirect page if logged in"

PHP
3

if user logged in wordpress

if ( is_user_logged_in() ) {
   // your code for logged in user 
} else {
   // your code for logged out user 
}
Posted by: Guest on September-11-2020
0

how to redirect from home page to custom link if not logged in in wordpress

add_action( 'admin_init', 'redirect_if_user_not_logged_in' );

function redirect_if_user_not_logged_in() {

if ( !is_user_logged_in() && is_page('slug') ) {

      wp_redirect( 'http://your-redirect-page-here '); 
   
   exit;
   }
}
Posted by: Guest on July-29-2021

Code answers related to "wordpress redirect page if logged in"

Browse Popular Code Answers by Language