Site logo

Archived topic

Removing "archives" from Categories page titles

3 replies · Started by Marc on June 14, 2020

Viewing posts 1–4 of 4

Hey there, I have a couple of category pages on my site that I link to from the menu, one example is https://www.blindluminations.com/podcast/

As you can see, the word "archives" is in the page title but not in the header. How do I remove the word "archives" from category pages like these? I've seen posts about the get_archive_title filter but I'm not knowledgeable enough to know if it's relevant in this case... or how to customize it for my use if so.

I generally use the code snippets plugin recommended by Tom or hooks from GP Premium to implement code. Any instructions using those methods would be hugely appreciated.

Thanks in advance for any help you can offer!

Hi there,

how did you add the link in the menu ? As you should be able to edit the Label

Hiya.

This was such an annoying thing to find out; I'll paste the solution that works for most cases (it did for me) and the link to where I got it from.

// Simply remove anything that looks like an archive title prefix ("Archive:", "Foo:", "Bar:").
add_filter('get_the_archive_title', function ($title) {
    return preg_replace('/^\w+: /', '', $title);
});

Link: https://wordpress.stackexchange.com/questions/175884/how-to-customize-the-archive-title/175900

This archived topic is closed to new replies.