title: change homepage for logged-in users in wordpress
body: <p>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:</p>
  
  <pre><code>add_filter('get_the_permalink','my_permalink_redirect');
  function my_permalink_redirect($permalink) {
  if( is_user_logged_in() ) { 
  global $post;
      if ($post-&gt;ID == 1) {
          $permalink = 'http://localhost/homepage-for-logged-users';
      }
      }
      return $permalink;
  }
  </code></pre>
  
  <p>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!</p>
  
  <p>edit:I got it working with the pluging "login with ajax" where I could define redirects after logins and I putted this snippet in my functions.php.</p>
  
  <pre><code>// Redirect users who arent logged in and on a 404 to the home page for logged out users
  function login_redirect() {
  
      // Check to see if user in not logged in and on the home page for logged users
      if(!is_user_logged_in() &amp;&amp; is_404()) {
            // If user is, Redirect to home page for logged out users.
             wp_redirect(home_url('home-logged-out'));
             exit;
  }
  
  }
     // add the block of code above to the WordPress template
  add_action( 'wp', 'login_redirect' );
  </code></pre>
  
  <p>*I made the pages for logged-in users private so logged-out users will see 404. Not a very clean method, but it works for now...</p>