By default, WordPress adds a label like “Category:” or “Author:” in front of archive page titles, so instead of showing just “Travel” or “Jane Smith,” the page displays “Category: Travel” or “Author: Jane Smith.” If you want cleaner, more polished titles on your site, there’s a simple way to strip that prefix out without touching your theme’s core files.
Why WordPress Adds These Prefixes
WordPress automatically prepends a label to archive titles to make it clear what kind of page a visitor is viewing — a category, tag, author, or date archive. This is generated by the get_the_archive_title() function, which is a common source of support requests because many site owners want a cleaner heading without the extra label.
Add a Code Snippet to Your Child Theme
The most reliable way to remove these prefixes is by hooking into the get_the_archive_title filter in your child theme’s functions.php file. This lets you override the default title output for each archive type individually rather than editing your theme’s templates directly.
Add the following code to your child theme’s functions.php file:
function my_theme_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>';
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
} elseif ( is_tax() ) {
$title = single_term_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'my_theme_archive_title' );
This function checks what kind of archive page is being displayed, then returns just the term name, author name, or taxonomy title on its own, without the automatic prefix.
Why This Approach Is Better Than CSS
Some site owners try to hide the prefix using CSS instead, but that only visually hides the text rather than actually removing it. The filter method changes the underlying title output itself, which means it also stays consistent across search engine results, browser tabs, and anywhere else the title is pulled from.
Using a Code Snippets Plugin Instead of Editing Files
If you’d rather avoid editing theme files directly, you can add this same code using the Code Snippets plugin. Install and activate the plugin, go to Snippets > Add New, give it a name, and paste the function and filter above into the snippet editor. This keeps the change intact even if you switch or update your theme later, since it isn’t tied to theme files that get overwritten.
A Few Things to Keep in Mind
- Always make this kind of change in a child theme, not your main theme, so it doesn’t get wiped out during theme updates.
- If your theme already uses a custom archive title function, adding this filter on top of it could cause conflicts — check your theme’s functions.php first.
- Some themes ignore
get_the_archive_title() entirely and hardcode their own archive headings, in which case you’d need to edit the relevant template file directly instead.
Join The Discussion
Have you run into any theme-specific quirks when customizing archive titles, or found another method that worked well for your site? Share your experience below.