When we read a post, we find metadata such as categories, date and author. But you may not be interested in showing your name as an author in your posts, if you want to be anonymous or there are multiple members work in a blog post. but WordPress does not let us make this option to remove the author name.
There are advantages and disadvantages to not having an author name appear on posts in WordPress, having an author allows you to show visitors that the person writing is experienced and credible. Maybe a post without an author does not make us feel much credibility for what we are reading.
In this post we will be learning the easiest ways to remove the author name in WordPress posts.
Remove the Author Name With A Plugin
Hide/Remove Metadata is a very easy-to-use plugin that will help us with the task of removing the author from the posts, even if you don’t have much knowledge.
In the configuration page we will find three customization options: Hide by, Hide author and Hide publication date.
In the Hide By option we have CSS and PHP.
-
- CSS. With this option we will partially hide the information, this means that if you use the browser inspector, you can see the information.
- PHP This option completely eliminates the author. Not even using the browser inspector will be able to see the author, or the date, if that is what we have selected.
The rest of the options are easy to understand, if we want to hide the author and the date.
Once the changes have been made, click on Save Changes.
Remove the Author Name By Code
We can also remove the author name by code.
In this case you will have to know that, this method is better to use if you are using a child theme, because at the moment that the creator of the theme you are using sends an update, your code will disappear, and the author will be shown again.
Having the code in your child theme, even if your main theme is updated, the code you have with this method will not be deleted.
In this case, if you still don’t have clarity about what a child theme is, you can read this post that will answer your questions, Create Your Genesis Child Theme
As we said before, WordPress does not give us the option to remove the author name, so in this case, when using code, we will have to be a little more than beginners, since we are going to add code that can modify the behavior of the theme if it is not done correctly.
We will assume that you already have your child theme, now, we can modify the functions.php file, or the template-tags.php file.
For example, the default Twenty Nineteen theme uses the function twentynineeen_posted_by to display author name and post date/time. This function is defined in the template-tags.php file.
function twentynineteen_posted_by() { printf( /* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */ '<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>', twentynineteen_get_icon_svg( 'person', 16 ), __( 'Posted by', 'twentynineteen' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); } endif;
This function shows us the name of the author, if you want to hide it, you must delete the code of this function. The remaining code will look like below.
function twentynineteen_posted_by() { }
Don’t forget to save the file when you’re done.
Use A Generic Name
Another alternative way to hide the author in WordPress publications is to create a generic name and use it for all your past and future articles. You can do this if you don’t want to show the real author. Just add a new author and assign a generic username. Then you must change the name of the author before publishing each publication.
Add a new User.
Next you have to edit the user you just created.
Change the Role for Author .Go to Nickname option and type the name which you want to be displayed. Then, click on the drop-down menu which is beside to Display name publicly as option and select the nickname you had just entered.
Go to Posts → All Posts and check all Posts, select Edit and click on Apply button.
In the drop-down menu, select the user you just created and click on the Update button.
References:
beautifulthemes.com
devotepress.com
greengeeks.com
wpbeginner.com
Leave a Reply