How to remove author from WordPress posts?

Want to hide the author name from WordPress posts but don’t know how to do so? Follow the steps we’ve shared here.

WP pages boast the following details in a section called meta info – the writer’s name, publishing/updating date, and comments count. The meta information is shown below the title. The writer’s name is linked to the author URL, and every post has a date linked to it. The comments count is nothing but the number of comments posted on the page.

Although there’s no harm in keeping the meta information on the page, some users may want to get rid of it for some reason permanently. Let’s look at the steps you can follow to get rid of author details from the post. The methods we have shared here will let you remove the date and comment fields from the WP page as well.

Use CSS

With cascading stylesheet code, you can get rid of any item from the WordPress page. On a well-designed WP site, the writer’s name is always accompanied by the attribute rel. If your WP theme page has the attribute rel, you can hide the name using the following CSS code

a[rel="author"] {display:none;}

If the following code doesn’t hide the author name, follow the below steps:

Right-click on the link and click the “Inspect” menu option. The browser will show the HTML code responsible for displaying the URL to the user. If you observe the link closely, you’ll find that it is enclosed in the div or a span HTML element. Note down the class name or ID of the element.

If the author link is in a div and this div has the class name “author“, use this CSS code to hide the writer’s name/URL in the post meta info field – div.author{display:none;}. If the div doesn’t have the class and has an ID, use this code div#author{display:none;}. We use the dot selector for the classes, and for the IDs, we use the hashtag to select an element. If the link is enclosed in an HTML span element, replace div with span. That’s it!

Manually removing the author by editing the PHP file

Author sprintf method

The single post page is the file you will have to edit to remove the author link and name from the content pages of your website. Before making any changes to it, back up your WordPress website.

Click the “Theme File Editor” option under the “Appearance” Menu and find the file named “single.php” in the list of files you’ll find on the right side. Press the ctrl and f buttons on the keyboard to open WordPress’s built-in word finder tool.

Enter the word “author” in the textbox and press the enter key. If the search utility doesn’t find any match, look for the file named entry-meta or single under the folder “template parts” and use the find utility to find the line which will render the writer details on the page.

If the WordPress search tool finds and highlights the line, replace the entire sprintf function with ="" if the output of sprintf is assigned to a variable. Most theme developers use the sprintf function to render the author details on the page.

Replacing it with ="" will make the variable have a blank value instead of the writer’s information. If the sprintf output is not assigned to any variable, get rid of the entire function.

So, these are the two methods you can follow to remove the writer’s name and link from the posts.

pramod
Pramod

Pramod is the founder of wptls. He has been using WordPress for more than nine years. He builds web applications, and writes about his experiences with various WP products on this site.

Leave a Reply

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