How to remove parent taxonomy name from the title generated by wp_title()?

I have a custom taxonomy “Portfolio Categories”, and a few these categories say “Cloth”, “Shoes”, …

When open some category page, i want the title to be like ‘Site Name | Cloth’, but with wp_title(), it becomes ‘Site Name | Portfolio Categories | Cloth’

How do i remove the “Portfolio Categories” from the title?

1 Answer
1

Hi @Edward:

This is not a generic solution but will probably solve your needs. If you want to get rid of the '| Portfolio Categories' from your site’s title just hook the 'wp_title' filter in your theme’s functions.php file and remove that from the title string. Copy this code to the bottom of that file and modify as need be:

add_filter('wp_title','your_wp_title');
function your_wp_title($title) {
  $title = str_replace('| Portfolio Categories','',$title);
  return $title;
}  

Leave a Comment