Monday, 23 October 2017

How to Remove Author Name from WordPress Posts

Do you want to remove the author name from your WordPress posts? By default, WordPress does not have an option to publish articles without an author name. In this article, we will show you few different ways to remove author name from your WordPress posts.

Remove author name from WordPress posts

Method 1: Remove Author Name from WordPress Posts Using a Plugin

This method is easier and recommended for all users. However, it may not work with all WordPress themes.

First thing you need to do is install and activate the Show Hide Author plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Plugins » Show/Hide Author page to configure plugin settings.

Show/Hide Author settings

The plugin automatically hides author name for all post types. If you want to display the author name for a specific post type, then you need to select it on this screen.

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

This plugin can hide author name in most cases. However, your WordPress theme may still show accompanying text before the author name. For example, ‘by John Smith’ would now just show ‘by’.

To hide this byline, you need to visit your website and take the mouse over to the text you want to hide. Next, you need to right click and select Inspect tool from your browser menu.

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

Byline text class

Next, you need to copy the CSS class used here and then paste it in the plugin settings under Advanced options.

Add byline class to hide it

Don’t forget to click on the save changes button to store your settings.

Method 2: Manually Remove Author Name from WordPress Posts

This method requires you to edit WordPress theme files. If you haven’t done this before, then please take a look at our guide on how to copy and paste code in WordPress.

Note: Make sure that you create backup of your theme or child theme before making any changes. If something goes wrong, then this will help you easily revert changes.

WordPress themes use different variations of code to display 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.
}

Now you just need to remove the code that outputs the author name. Take a look at following example:

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.
}

Don’t forget to save your changes and upload the files back to your website.

You can now visit your website to see your changes in action:

Author name removed by manually editing theme files

Method 3: Create a Generic Author Name for Publishing WordPress Posts

This method does not remove the author name, but it can be used as a workaround.

Basically you will create a generic author name and use it for all your past and future articles. You will need to change the author name before publishing each post.

This method is irreversible. If you do this and want to revert back, then you will have to edit each post and assign it to the original author manually.

That being said, let’s get started.

First add a new author to your WordPress site and give it a generic username such as editorialteam.

Add new user

Next, you need to visit Users » All Users page and click on the ‘Edit’ link below the username you just added.

Edit user

On the user profile screen, scroll down to the ‘Nickname’ option and enter the name you want to be displayed (for example: Editorial Team).

After that click on the drop down menu next to ‘Display name publicly as’ option and select the nickname you just entered.

Select display name

You can also add a generic bio and even create a gravatar for that user account.

Now go to Posts » All Posts page and click on the screen options menu at the top. Enter 999 for number of items to display.

Show all posts on screen

This will allow you to quickly edit and change author name for a large number of posts.

You need to select all posts using the checkbox and then select edit under the bulk actions drop down menu. After that click on the ‘Apply’ button to continue.

Select all posts for bulk editing

WordPress will now show you the bulk editing options. You need to change the author to the generic author name you added earlier and then click on update button.

Bulk change author name

WordPress will now update all selected posts and change author name. Remember, this process may take some time depending on how fast your WordPress hosting is.

If you have more than 999 posts, then you will need to go to page 2 and repeat the process.

That’s all, you can now visit your website to see it in action.

Team author name

We hope this article helped you learn how to remove author name from WordPress posts. You may also want to see our list of 25 effective ways to monetize your website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Remove Author Name from WordPress Posts appeared first on WPBeginner.



source http://www.wpbeginner.com/wp-themes/how-to-remove-author-name-from-wordpress-posts/

No comments:

Post a Comment