• Resolved momotaro990

    (@momotaro990)


    Hi Anders. Hope you’re good today.

    I got a little bit of a problem. As the title suggests, I want to remove “Category: ” on my archive title. I want to remove it since it is actually shown on Google search results making my actual title narrower.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @momotaro990,

    If you want to remove “Category:” from the Google search results, hiding that part on the page won’t help you, since Google retrieves the title from the <title> attribute on the page (the one shown in your browser tab/window). To change that, you’ll need to install a SEO plugin like Yoast SEO and change the title attribute for archive pages.

    — Anders

    Thread Starter momotaro990

    (@momotaro990)

    I completely understand what you mean. What I really wanted to do is basically remove “Category: ” completely through the theme editor (somehow).

    I use Yoast SEO right from the beginning when I made my website (about a year and a half ago). I edit nearly all pages what it’s gonna look like on search results.

    All my archive pages have been edited to look what I want (without “Category: “). I look at the search preview built-in by Yoast SEO and no “Category: ” whatsoever.

    But things changed since I found my web on search result. I see “Category: ” before my title. I think Google takes the actual archive-title on my pages instead of one I edited in Yoast SEO. So if that’s the case then, I need to remove “Category: ” from my pages right?

    Do you have any idea how to delete/remove “Category: ” right from the theme editor?

    I don’t want to hide it, I want to remove it completely.

    Btw, I’m sorry for not making my question clear enough.

    Theme Author Anders Norén

    (@anlino)

    @momotaro990 I see. Hiding it with CSS is pretty easy, but to remove the output completely, you’ll have to create a child theme and add the following code to its functions.php file:

    add_filter( 'get_the_archive_title_prefix', '__return_empty_string' );

    — Anders

    • This reply was modified 3 years, 2 months ago by Anders Norén.
    Thread Starter momotaro990

    (@momotaro990)

    It works like a charm. This is what I wanted.

    Thank you so much, Anders.

    Btw, I got one more thing to ask (if you don’t mind).

    Can you please give me another code to remove comment-URL (website box in the comment section)? People keep spamming over and over again.

    Once again, thanks for the code.

    Theme Author Anders Norén

    (@anlino)

    My pleasure! Spammers will still be able to submit a URL even if you hide the field in CSS, so I’d recommend you to install a plugin to do it instead.

    This one looks like it should do it: https://www.ads-software.com/plugins/remove-comment-websiteurl-box/ (It’s old, but should still work on recent versions of WordPress.)

    Thread Starter momotaro990

    (@momotaro990)

    Alright, I’ll check that out. Btw, thanks for the code, you’ve been very helpful.

    I think I’ll update the status of this thread as resolved.

    See Ya. Anders.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to Remove “Category: ” before Archive Title?’ is closed to new replies.