Skip to content

Instantly share code, notes, and snippets.

@reidelliott
Created April 12, 2018 05:32
Show Gist options
  • Save reidelliott/0df758cb5f470578fc8f01322d1dbf25 to your computer and use it in GitHub Desktop.
Save reidelliott/0df758cb5f470578fc8f01322d1dbf25 to your computer and use it in GitHub Desktop.
/**
* Removes the "Archive" prepending category and custom post type archives
* @author Reid Burnett
*/
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
}
if( is_post_type_archive() ) {
$title = sprintf( __( '%s' ), post_type_archive_title( '', false ) );
}
return $title;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment