Skip to content

Instantly share code, notes, and snippets.

@mrwweb
Created December 16, 2015 22:35
Show Gist options
  • Save mrwweb/267e67de060017f52487 to your computer and use it in GitHub Desktop.
Save mrwweb/267e67de060017f52487 to your computer and use it in GitHub Desktop.
Simple category and other archive page titles in WordPress 4.1+
<?php
add_filter( 'get_the_archive_title', '{prefix}_cat_title' );
/**
* Remove "Category: " prefix from Category archive pages
*/
function {prefix}_cat_title( $title ) {
if( is_category() ) {
$title = single_cat_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', '{prefix}_term_title' );
/**
* Remove "Category: ", "Tag: ", and "{Taxonomy}: " prefixes from all term archive pages
*/
function {prefix}_term_title( $title ) {
if( is_category() || is_tag() || is_tax() ) {
$title = single_term_title( '', false );
}
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment