change homepage for logged-in users in wordpress
-
In wordpress i want a different homepage for logged-in users and those who are logged-out (simple changing the redirect url when somebody clicks on the title of my website). Is there a way of doing this by adding a code snippet in my themes functions.php? I tried:
add_filter('get_the_permalink','my_permalink_redirect'); function my_permalink_redirect($permalink) { if( is_user_logged_in() ) { global $post; if ($post->ID == 1) { $permalink = 'https://localhost/homepage-for-logged-users'; } } return $permalink; }
unfortunately it doesn’t work and it would be unhandy to change the function from localhost to my domain name when i upload the site to a live hosting. can somebody give me some advice? Thanks!
- The topic ‘change homepage for logged-in users in wordpress’ is closed to new replies.