How to Hide Author Name from Your WordPress Posts
Published WordPress blog posts will, in most cases, include relevant metadata like author name and publishing date thanks to your theme’s code. While this is a beneficial feature, on some occasions, you will need to change or remove this data from your website. In this article, we will cover the process of changing or removing the author’s name from a WordPress post, specifically.
Even though this might sound like an easy task, it can be quite challenging as there are no in-built options for it within WordPress. We will explain several methods that vary in difficulty so that you can choose the one best suited to your needs and existing WordPress knowledge. We will also touch upon the reasons why you would want to change or remove an author’s name, as those can vary depending on the case. If you’d like to skip to any specific part of the article, just click on one of the links below:
There are quite a few reasons for changing or removing the author’s name from posts. Therefore, before proceeding to the how-to’s of this article, let us quickly cover possible motives.
Articles could be written by authors who wish to remain anonymous, especially if the topic of the article is highly sensitive or controversial. You may also simply want to improve your posts visually. The easiest way of achieving it is by removing added metadata, such as the author name or date, that might cause the posts to look cluttered or visually unappealing.
On the other hand, you could be running a sizable multi-author team. In that case, the articles would pass through an intricate screening process before being published. As such, changing the name of your author to one more generic and easily associated with your website is warranted. The added benefit of this approach is that if a single author decides to stop working for your website, it will be less noticeable.
How to remove the author name from your WordPress posts
Depending on the theme or plugins you are using, the process of changing or removing the author’s name differs substantially. Some themes or plugins may have in-built options for this purpose, while others don’t. But, plugins, in general, are prone to compatibility issues with other plugins or themes. And, the options of a particular theme might not be available after switching to another theme. Thus, it is important to know the approaches that circumvent these issues. In this article, we have included three such methods.
Sometimes, using a generic, non-revealing name is a better alternative to completely removing the author’s name from your blog posts. This option is quite beneficial for articles written by a team of people, like an editorial team or team of freelancers, with a clear and determined writing style. As we noted previously, it makes the absence of a particular author less noticeable as long as the same writing style is maintained.
We will show you how you can replace an author’s name for both a single post and all the posts. For either option, you need to have an additional WordPress user with a generic name. If you don’t already have it, you can add one now. Log in to your website with your administrator user-role account and navigate to Users > Add New. Afterward, fill in the required info and any other you wish to add, choose the Author or Contributor user role, and press the Add New User button.
-
Replacing the author name on a single post
To change the author on a single post, open the post in question for editing. Depending on which page builder you are using, the following steps differ slightly.
If you are using Gutenberg as your page builder of choice, then navigate to the top right section of your screen. Click on the Document tab, followed by a click on the Status & Visibility section. Find the Author option, select the previously created author, and press the Update button.
If you are using a different page builder (such as Classic Editor or WPBakery Page Builder), then you need to enable the Author section first. Click on the Screen Options in the top right corner of the screen and tick the checkbox next to the Author option.
Then, scroll down to the Author section, select a new author, and press the Update button, located in the Publish section on the right.
-
Bulk-replacing the author name
To replace the author’s name on all your posts, navigate to Posts > All Posts first. Click on the Screen Options and find the Number of items per page option. Insert 999 (which is the highest possible number available) and press the Apply button.
Select all posts by ticking the checkbox next to the Title column, then select the Edit option from the dropdown menu above, and press the Apply button after.
In the options above the list of posts, choose a different author, and press the Update button.
These settings will apply for all posts shown on the page, meaning up to 999 posts. If you have more than 999 posts, you will have to perform the same steps for each of the remaining pages within the Posts navigation.
If you are the only author on your website, removing the author’s name is a logical step, as you might not need to keep it. Or you may simply want to eliminate the author’s name from the display to improve the design of your WordPress posts. In either case, you will need a bit of coding knowledge to carry out this approach. But, don’t be alarmed, we will carefully explain two possible methods of removing the author’s name using code.
The first and arguably easier method is to hide the author name using CSS. We are purposely using the term “hide” instead of “remove”, since using CSS as a solution will keep the author’s name in the code, but will not be visible on the frontend of your website.
Click to view one of your posts, right-click on the author’s name, and press the Inspect option. This will open the Elements tab of your browser’s developer tools. You can also do the same by pressing the F12 key on your keyboard for Windows or Command+Option+J for Mac.
From the Elements tab, locate the HTML element that wraps both the author name and the By: label. You can do so by hovering over different HTML elements until the one that contains both By: and the author’s name is highlighted on the page.
This inspection process is the same regardless of your theme. But the wrapping element and its CSS classes, if it has any, can differ significantly between different themes.
As you can see in the screenshot above, in our example, the corresponding wrapping element is a div whose class is mkdf-post-info-author. From a coding standpoint, to hide your author as well as the By: line, you only need to apply the display: none; rule to the appropriate CSS selector. Therefore, the simplest solution in our case would be to use the code given below.
.mkdf-post-info-author { display: none; }
This code will hide all HTML elements with the class mkdf-post-info-author. You can specify your CSS selector even further if needed.
After creating your code, navigate to Appearance > Customize > Additional CSS. Insert the code and press the Publish button. We also suggest adding helpful comments regarding the code. They can prove useful in troubleshooting any issues later, as well as keep the code snippets structured and less cluttered.
Since the author’s name and other relevant metadata is shown thanks to the code used in your theme, the other coding approach to this problem is to remove the code from the appropriate theme template file. Doing so will require some coding knowledge and general WordPress familiarity. Before starting, we suggest that you back up your files, as improper editing causes errors that could break your site.
To remove the code, you first need to locate the template file that contains it. Depending on the file and folder structure of the theme you are using, this can prove to be a difficult task. Luckily, WordPress has a few plugins that can help us narrow the search or even pinpoint a specific template file. The one we found most useful for this article is the String Locator plugin. As the name of the plugin suggests, it outputs all the template files that include the string you searched for. We are going to use it to find a template file that contains the wrapping element with the author’s name. We are going to do this by searching for its custom class (mkdf-post-info-author, in our example). If you aren’t sure how to find that element and its custom class, you can find the steps described in the previous section of this article. But, be aware that the precise element and class name can vary significantly based on the theme you are using. Now we can proceed to the steps required for this method.
After installing the plugin, navigate to Tools > String Locator. Choose the folder you wish to search, insert the search string (custom class or ID), and press the Search button.
To clarify, we limited the scope of the search to the wp-content directory, which includes both the plugin and theme files. But, in this particular case, you can narrow the search down to the directory of the theme you are using. Depending on your understanding of the WordPress file and folder structure, you can choose to narrow down the search scope even further.
Also, the String Locator plugin offers the possibility of a RegEx search. In this case, we are searching for an exact string instead of a pattern, so we don’t need to enable that option.
The search will provide you with a list of files matching the conditions, which will help you significantly decrease the number of files you need to examine. However, only on the rarest occasions will you be able to get the exact file you need as a single search result. So, to narrow the search results further, look at only the .php files (files whose name ends with .php). In most cases, the .php files are the ones responsible for adding functionality and HTML structure to your website. And showing the author’s name, wrapped with corresponding HTML elements, is an excellent example of both.
Depending on the string label you use, there could be duplicate file entries in your search results. So, look carefully at the file paths; they can help you pin down which search result entries are unique files and which are duplicates.
Once you’ve eliminated all the duplicate file paths, click on each one and review the code within. Look for the same HTML structure that you found earlier using Inspect.
When you find the file you need, all you have to do is edit it. You can remove or comment on lines of code using the String Locator plugin.
If you choose to remove the code that shows the author’s name on your site, make sure to delete everything between the two appropriate tags. If the code is wrapped <div> in tags, click on the opening <div> tag and this will automatically highlight the closing </div> tag. The same applies if the code you’re removing has any other kind of tag, such as <p> tags. Simply delete everything between those tags, including them. Failing to remove the whole code section or partially removing some the remaining code carries with it the risk of breaking your site.
Editing the same file can also be done via FTP. It is very useful to keep this in mind if you happen to make a mistake while editing and lose access to your dashboard. By getting hold of the same file using FTP, you will be able to either remove the changes or try to correctly edit the file, to solve the error.
Final thoughts
Now that you are made aware of the different reasons why hiding an author’s name is beneficial, you can consider whether this is the right choice for your site, too. And you can examine the options in this article and pick which approach best suits your requirements and skill level. As situations where changing or removing an author name are more frequent than you might think, we suggest bookmarking this article for future use.