Skip to content

Hide the author name on pages and posts

If all the content on your website has a single author, it may be superfluous to display author name on every post, especially if your name appears in billboard sized letters on the header.

Many themes let you turn off author name display on all pages, all posts, or both. Look for that in Customize. If you have it, and it satisfies your needs, use that, and you can stop reading (but still sign up for my newsletter for other useful tips).

If your theme doesn’t provide that option, or if you want to decide whether to display the author name on individual pages and posts, read on.

Use a plugin?

I’ve looked, and unfortunately no plugin works in all cases. The example in the next section shows why it’s challenging to write such a plugin.

On every page and post…

The Hide/Remove Metadata plugin by Catch Plugins is a good example of the genre. It lets you hide author name and/or timestamp globally — on all posts and pages — in one of two ways. The “php” option steps in while the page is being put together by the server and volunteers the information that the author name is blank, so it never gets sent to the browser. The “css” option generates a style rule that attempts to make the “by line” invisible if it’s present in the HTML.

If hiding the author name everywhere is your goal, try this plugin and see whether it works in your case. It has its own setting screen in the dashboard, where you can select what information to hide and whether via css or php. Try both ways and see whether one works with your theme.

On selected pages…

I haven’t found a plugin for this, but I’m considering writing one, something where you could check a box while editing a page or post to hide the author on just that page or post. Watch this space. Meanwhile, read on.

Globally hide author name with CSS

For this to work, your theme has to have a way to add CSS rules through Customize. Most do. It’s just a matter of finding out what CSS to add.

Find a page that has the information you want to hide. Launch the developer tools in the browser to inspect that part of the page (generally, right-click the text in question and select “inspect element” or the like from the context menu). This shows the HTML code side by side with the page (or top and bottom — it’s your option), and on both sides highlights the portion you asked to inspect.

In this case, the highlighting shows the “by line” is displayed within a “li” element, and includes the post categories. Different themes will use different coding. Here’s the HTML for this example (which uses Graphene theme):

<li class="byline">
By <span class="author">
<a href="https://..." rel="author">Ed Generic</a></span>
<span class="terms"><a class="term term-category term-1" href="">Uncategorized</a></span>

What we’re looking for is a “container” element (such as “li” or “span”) which includes only the bit we want to hide, so we can tell it to hide just that element.

Unfortunately, in this case no such element exists. The “li” includes both the author name and the category, which you might prefer to display, and the first “span” includes only the author name, with the word “By” preceding it. So we could hide just the author name, but that would leave the text “By in Uncategorized”, which is stupid.

If you want to hide just “By authorname” and not the categories, you either have to use a different theme or do some fancy tricks I will describe further on.

For now, let’s say we’re okay with hiding the entire byline including categories. We should be able to do this with a CSS rule that says not to display anything with the “class” of “byline”.

So, in Customize, I go into the custom CSS rules section and add the following:

/* Hide the author name on every post */
.byline { display: none }

This should work on the post page itself. Archive pages may still display the author name in the lists of posts, but there are so many ways to list posts, most of which let you minutely control the display, that I can’t address that here. I mean, you could do something similar to what I just described, but on an archive page, but it’s better to use the options of the theme or post-list plugin, if there are any.

Remove all author information with text substitution

As we saw in the above example, some themes are not designed to make it easy to remove just the author name and not other information you want to keep. I’m now going to continue with that same example and show how to do that by reaching into the HTML after it’s been generated and changing bits we don’t like.

I do this using the plugin Real-Time Find and Replace by Marios Alexandrou. This ingenious tool lets is like find and replace in a text editor, only you’re replacing in the HTML just before it’s sent to the browser. It also has a wildcard search feature in case the text you want to replace is long or might not always be the same.

The wildcard search uses a standard syntax called “regex“, short for “regular expression”. If you check the Regex box, you must add “/” at the beginning and end of your search expression.

Real-Time Find and Replace settings screen showing the settings described in the text below.

So if I want to change “By name in categories” to just “Posted in categories“, I might use the Find expression:

/By <span class="author">.*?> in/

and the Replace string:

Posted in

The characters “.”, “*”, and “?” (and several others) have a special meaning in the regex language. To search for these as literal characters, you must “escape” them with a preceding “\”. Read the regex tutorial I linked to above, or any of dozens of others online, for full details. In the context shown here, they mean “any number of any character, but the least number you need to match the whole expression.”


If you use the regex checkbox, enclose your search expression in “/” characters, or your website will just be blank pages until you fix it.

When you save these settings, author name will vanish for all posts. What if you only want to hide the byline on some posts?

Hiding the byline on only some posts

Until I get around to writing that plugin, it’ll take a little trick to optionally hide the byline. The trick involves creating a second user on your website — let’s name them “Nobody” — and arranging it so all posts by “Nobody” have the byline hidden, using the Find and Replace plugin as shown in the previous section.

So add a user, go to Users in your dashboard and click Add New. (Don’t worry, you’ll never have to switch logins. The other user only has to exist.)

I filled in the username Nobody, made up an email address, unchecked the option to send email to the new user, and made their role Editor.

When editing a post, use the Author field to specify that, even though you are logged in creating the post, the real author is Nobody.

Now, set up your Find and Replace settings, the Find expression needs to match only posts by the new user. The “Find” expression now will be:

/By <span class="author">.{20,70}?Nobody<\/a><\/span> in/

By making a more precise match, we can strip out the author name for all posts authored by Nobody, and leave it alone for other posts. Since “/” is a special character for regex, I added a “\” in front of it to show I really meant “/” and not the end of the search expression. Also, I used the expression “.{20,70}?” which means, from 20 to 70 of any character, but only as much as needed to make a match. I did this because the byline can also appear in archive pages, where there may be multiple posts listed. Here’s an example where the first post is by Nobody, the second by the administrator, Ed.

If I’d said “.*”, letting the wildcard part of the search be of any length, it could’ve matched from the “By” in a “By Ed” to the “Nobody” in a “By Nobody” much farther down the page, resulting in our deleting huge swaths of the page.

Limiting the length insures the back part of the expression, containing “Nobody”, matches the “By” from the front part of the same byline. It probably is also faster since the pattern matching code doesn’t have to look at the whole rest of the page to determine that there’s not a match on the pages authored by Ed.


As always, there remains the possibility I missed some obvious easier way to do this stuff. If so, please let me know in the comments! I hope this will solve your problem for now, and will motivate you to subscribe to my newsletter so you’ll get the announcement when I create a plugin to solve this. I’ll have to have special code for some themes, probably, unless the folks who do Graphene take my advice and make their theme more compatible with standards!


Leave a Reply

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