Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: The redirect which takes logged in users away from site root page 'example.com'

@henrywright-1

Member

@mercime I should have added more info

It is default behaviour when the WP static front page is set to “Register”. I actually came up with a way of doing what I needed with the help from folks over at Stack Overflow:
http://stackoverflow.com/questions/20039607/different-wordpress-front-page-for-logged-out-and-logged-in-users

My final code after some minor tweaks to the accepted answer is:

function bp_custom_front_page() {
	if ( ! is_admin() ) {
		if ( is_user_logged_in() ) {
    		$page = get_page_by_title( 'Contact' );
    		update_option( 'page_on_front', $page->ID );
    		update_option( 'show_on_front', 'page' );
		} else {
   			$page = get_page_by_title( 'About' );
    		update_option( 'page_on_front', $page->ID );
    		update_option( 'show_on_front', 'page' );
		}
	}
}
add_action( 'init', 'bp_custom_front_page' );
Skip to toolbar