Redirect Homepage to another page when user login

If you want to redirect the user after login use the below code: /** * WordPress function for redirecting users on login based on user role */ function wpdocs_my_login_redirect( $url, $request, $user ) { if ( $user && is_object( $user ) && is_a( $user, ‘WP_User’ ) ) { if ( $user->has_cap( ‘administrator’ ) ) { … Read more

Re-Direct ALL Users to the Home Page IF not logged in

Perhaps something like this? add_action( ‘template_redirect’, ‘not_logged_in_redirect_home’ ); add_action( ‘do_feed’, ‘not_logged_in_redirect_home’ ); function not_logged_in_redirect_home(){ if ( is_user_logged_in() ){ return false; } if ( ! is_home() // use this option if you show blogs posts on the home page // ! is_front_page() // use this if you show a static page ){ wp_redirect( home_url() ); exit; … Read more