How can I include custom category and tag base names in the category and tag template files? Specifically, I'd like to include in the page title of category and tag pages the custom category and tag names.

For example, if a site admin goes to Settings > Permalink and specifies: category base = location tag base = software

I would like the category page title to be: Location > single_cat_title

I would like the tag page title to be: Software > single_tag_title

I couldn't find a template tag that display this.

1 Answer 1


We were able to get custom category and tag base names using:

get_option('category_base', 'Categories')
get_option('tag_base', 'Tags') 

We wrapped these functions in ucwords() in order to capitalize the base name and replaced "_" with "":

ucwords(str_replace('_',' ',get_option('category_base', 'Categories'))
ucwords(str_replace('_',' ',get_option('tag_base', 'Tags'))

Finally we wrapped all this with the code for localization and added the single cat/tag title:

printf( __( ucwords(str_replace('_',' ',get_option('tag_base', 'Tags'))).' &raquo; %s', '2010-translucence' ), '<span>' . single_tag_title( '', false ) . '</span>' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.