Thanks for your time. I’m already using this code to create different “homepages” for logged in and logged out users and it’s working great:
/**
* When a user is logged in, tell WordPress to use ‘page’ on front page of the site
* @param string $value
*
* @return string
*/
function buddydev_set_page_as_front_for_loggedin_user( $value ) {
if ( is_user_logged_in() ) {
$value = ‘page’;//page is set as front page
}return $value;
}
add_filter( ‘pre_option_show_on_front’, ‘buddydev_set_page_as_front_for_loggedin_user’ );/**
* For logged in users, set our static page to act as home page
*
* @param $value
*
* @return int
*/
function buddydev_set_context_based_page_on_front( $value ) {if( ! is_user_logged_in() ) {
return $value;
}//for logged in user, use page id 9
return 1231;//change with your own page id.
}
add_filter( ‘pre_option_page_on_front’, ‘buddydev_set_context_based_page_on_front’ );However, when a logged out user clicks on my site logo, the code sends the user to page 1231 which only logged in users can see.
I want to send logged out users to a different page when they click the site logo.
Is this possible?
Hi Andrew,
Thank you for the reply.The simple way will be to visit Dashboard->Settings->Reading and set the page as Home page that you want to be visible to the logged out user.
Regards
Brajesh
You must be logged in to reply to this topic.