Setting different homepage for logged-in users

First, make sure you've defined a homepage in Settings -> Reading

To show a different homepage for users who are logged in, add this snippet to your site via functions.php or your favorite code snippets plugin:

add_filter('pre_option_page_on_front', 'override_homepage_for_logged_in_users');

function override_homepage_for_logged_in_users($page){
	if(is_user_logged_in() && !is_admin()){
		return 9; //replace with ID of page you want to show for logged-in users
	} else {
		return $page;
	}
}

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us