WordPress.org

Support

Support » How-To and Troubleshooting » how to exclude author name in admin posts

how to exclude author name in admin posts

  • yashmistrey
    Member

    @yashmistrey

    could it possible to hide / exclude author (admin) name in posts ?

    only post written by admin not authors

    i tried but it’s not work
    <?php the_author_posts_link($exclude_admin); ?>

Viewing 1 replies (of 1 total)
  • You can do something like this:

    <?php $getid = $posts[0]->post_author; if($getid == 1){ ?>
    /* DISPLAY ADMIN NAME BUT NOT LINK TO AUTHOR PAGE */
    Published by <?php the_author(); ?>
    		<?php } else { ?>
            Published by <?php the_author_posts_link(); ?>
            <?php } ?>

    Or, if you don’t want to display name

    <?php $getid = $posts[0]->post_author; if($getid == 1){ ?>
    		<?php } else { ?>
            Published by <?php the_author_posts_link(); ?>
            <?php } ?>

    Note id == 1 its default admin ID.

Viewing 1 replies (of 1 total)
  • The topic ‘how to exclude author name in admin posts’ is closed to new replies.