Skip to content

Instantly share code, notes, and snippets.

@mateusneves
Created October 26, 2015 12:34
Show Gist options
  • Save mateusneves/b3352ce8ce5599d8ffbf to your computer and use it in GitHub Desktop.
Save mateusneves/b3352ce8ce5599d8ffbf to your computer and use it in GitHub Desktop.
Remove the taxonomy name from wp_title() function
function mamaduka_remove_tax_name( $title, $sep, $seplocation ) {
if ( is_tax() ) {
$term_title = single_term_title( '', false );
// Determines position of separator
if ( 'right' == $seplocation ) {
$title = $term_title . " $sep ";
} else {
$title = " $sep " . $term_title;
}
}
return $title;
}
add_filter( 'wp_title', 'mamaduka_remove_tax_name', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment