Remove “Archives” Prefix in WordPress version 5.5.0 and newer

  • January 26, 2021
  • By Nic Scott
Home > Blog > Remove “Archives” Prefix in WordPress version 5.5.0 and newer

Today I was overjoyed to stumble across a new filter in the function that gets the archive title in WordPress: get_the_archive_title(). This filter allows you to easily change the word/prefix “Arhives: ” to whatever you want or to NOTHING.

I generally was never a fan of the prefixed text: “Archives: ” and “Category: ” coming before the post type name or the taxonomy term. I suppose it is WordPress’s way of letting you know where you’re at, but if the site is designed correctly and breadcrumbs are used, it’s sort of unnecessary. Plus, the word “Archive” sounds like its something old. Many times events are upcoming, and they are in the archives. Go figure.

It used to be sort of a hack and a PITA to make this text go away, often using something that looked like this:

add_filter( 'get_the_archive_title', function( $title ) {

     $title = str_replace( 'Archives: ', '', $title );

}, 10, 1);

But now, this is all you need:

add_filter( 'get_the_archive_title_prefix', '__return_false' );

SPLENDID.

Join Our Email List

By signing up for our monthly newsletter we’ll also GIFT YOU our 5W’s of Website Design Workbook to help you get started thinking about your website.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Crearé Web Solutions
1268 US Route 1, #72
Cape Neddick, ME 03902

201-345-4556
getstarted@crearewebsolutions.com

Copyright © 2012-2022 Crearé Web Solutions