How to Remove Author Name in WordPress Posts

When you publish a post, WordPress automatically displays the author of the article. It certainly is one of the useful and informative features in WordPress. But, there are times when you might want to remove author name in WordPress posts. By default, WordPress does not have an option to publish articles without an author name. However, there are some ways by which you can remove author name in WordPress posts. Today, here at DevotePress, we will be learning the easiest ways to remove author name in WordPress posts. So, let’s get started.

Remove Author Name in WordPress Posts Using a Plugin

The very first thing you need to do is to install and activate the Show Hide Author plugin from the WordPress Plugin Directory. Show Hide Author plugin is super easy to use and anyone, even the beginners can easily customize the plugin. However, this method might not work with all WordPress themes.

After you’ve activated the plugin, head over to Plugins > Show/Hide Author page to configure the plugin settings.

Plugins > Show/Hide Author page

The plugin will automatically hide author name for all post types. But, if you want to display the author name for the specific post type, you can select the post type on the configuration page.

You can also add custom URLs below the post types where you want to hide the author name.

The plugin will hide the author name. But, your WordPress theme may still show accompanying text before the author name, like ‘by DevotePress’ would now display ‘by’ only.

Don’t worry, you can hide this byline as well. You need to visit your website and take the mouse over to the text you want to hide. You need to right-click and select Inspect tool from your browser menu.

Inspect tool

Now, you need to locate the div class containing your author byline.

Copy byline

Copy the CSS class used here and paste it into the plugin settings under Advanced options.

Advanced options

Click the Save Changes button and store your settings. And that’s it. You have successfully remove the author name in WordPress posts.

preview

Remove Author Name in WordPress Posts Manually

This method requires you to edit your WordPress theme files. So, those who are familiar with coding can use this method to remove author name in WordPress posts.

Make sure you create a backup of your theme before diving into the coding. This will help you if something goes wrong.

WordPress themes use different variations of code to display the author name. You will need to locate the code responsible for displaying the author’s name in your theme files and delete it. Most common locations to find this code are single.php, content.php, archive.php, and index.php files.

In many cases, you will not be able to find the code that outputs author name. Instead, you will find a template tag defined in the functions.php file or template-tags.php file.

For example, the default Twenty Seventeen theme uses the function twentyseventeen_posted_on to display author name and post date/time. This function is defined in template-tags.php file.

 function twentyseventeen_posted_on() {
//Get the author name; wrap it in a link.
$byline = sprintf(
_x( 'by %s', 'post author', 'twentyseventeen' ),
'<span class="author vcard"><a class="url fn n" href=" ' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . get_the_author () . '</a></span>'
);
//Finally, let's write all of this to the page.
echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span> ; // WPCS: XSS OK.
} 

You need to remove the code that outputs the author name.

 function twentyseventeen_posted_on() {
//Finally, let's write all of this to the page.
echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
} 

Save your changes and upload the files back to your website. You can visit your website to see the changes.

Another alternative to hide the author in WordPress posts is to create a generic name and use it for all your past and future articles. This is the best thing to do if you do not want to show the real author. You just have to add a new author and give it a generic username. You will then need to change the author name before publishing each post.

And that is it. You can choose whichever method you feel comfortable with to remove author name in WordPress posts.

If you have anything to add, ask or share, feel free to use the comments section.

Source: WP Beginner

Leave a Reply

Your email address will not be published. Required fields are marked *