This topic has 1 reply, 1 voice, and was last updated 7 years by joy.

  • Author
  • #159988
     joy
    Participant

    Hello, how would I have the logo link to a specific page depending on a user being logged in? Thank you.

    #160059
     joy
    Participant

    I figured it out.

    COPY CODE
    // redirect home page if logged in
    add_action('wp_head','wpmy_redirect_logged_in_users_away_from_home');
    function wpmy_redirect_logged_in_users_away_from_home() {
        if( is_user_logged_in() && ( is_home() || is_front_page() ) ) {
    		wp_redirect('http://www.website.com');
    		exit;
        }
    }
    
    //allow redirection, even if my theme starts to send output to the browser
    add_action('init', 'do_output_buffer');
    function do_output_buffer() {
            ob_start();
    }
Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?