How to hide 'admin' name author from posts

  • galimbo

    #6713

    Hi, I would like to hide the admin name author from posts, only for ‘admin’ not for other authors’ name

    How can I do it?

    Thank you

    Prasanna SP

    #35350

    Untested, give it a shot.

    function hide_post_author_if_admin() {
    global $graphene_settings;
    $author = get_the_author_meta('user_login');
    if ($author == admin ) {
    $graphene_settings['hide_post_author'] = true;
    }
    }
    add_action( 'template_redirect', 'hide_post_author_if_admin' );

    galimbo

    #35351

    I added this code at the end of the file functions.php of Graphene theme but doesn’t run!

    Admin

    Syahir Hakim

    #35352

    Try this:

    function hide_post_author_if_admin() {
    global $graphene_settings;
    $author = get_the_author_meta('user_login');
    if ( $author == 'admin' ) {
    $graphene_settings['hide_post_author'] = true;
    }
    }
    add_action( 'template_redirect', 'hide_post_author_if_admin' );

    galimbo

    #35353

    it’s the same, doesn’t run

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.