• I’m sure this is very straightforward, but I’m struggling to work it out myself.

    If the current logged-in user visits his own author page, I want to display an element.

    Essentially I want ‘if author page = logged in user do this’

    Could you shed any light on this for me?

    Thanks,
    Kevin

Viewing 1 replies (of 1 total)
  • Take a look at using this hook, template_redirect, combined with these two functions is_author and wp_get_current_user.

    function centrecircle_my_page_template_redirect()
    {
        $current_user = wp_get_current_user();
        if( is_author( $current_user->ID ) )
        {
            //do something
        }
    }
    add_action( 'template_redirect', 'centrecircle_my_page_template_redirect' );
Viewing 1 replies (of 1 total)
  • The topic ‘Author page = logged in user’ is closed to new replies.