Hello, this is more of a 'is it possible' type question. Keep in mind, I am no php master by any means, but can generally figure things out : )

Say i have a wordpress site that is for displaying menu items, focusing on pizza. I have a custom post type of 'menu items' and i would need several custom taxonomies attached to that post type. Things like toppings, sauces, cheeses, crusts, etc…

BUT, what if the end user doesn't want to name their taxonomies that way, say they wanted specialty toppings, veggies, meats, gluten free, instead?

Is there a way for me to name my custom taxonomies something general like, ingredient set 1, ingredient set 2, ingredient set 3, ingredient set 4, ect...and in the theme options panel, set up some sort of override for that taxonomy name? Something like:

Taxonomy Name: Ingredient set 1 -> Friendly Name: Toppings
Taxonomy Name: Ingredient set 2 -> Friendly Name: Sauces


I have tried searching online but haven't found anything about it, but my wording could be off.

Any ideas would be greatly appreciated!

1 Answer 1


Yes, that's certainly possible, but you wouldn't override anything- instead you'd fetch and add the custom names when they're registered. For a quick example, say you have an option that stores the names:

$taxonomies = array(
    'ingredient_1' => 'Toppings',
    'ingredient_2' => 'Sauce'
add_option( 'my_tax_names', $taxonomies );

Then when you register the taxonomies:

$taxonomies = get_option( 'my_tax_names' );

foreach( $taxonomies as $key => $name ){
    register_taxonomy( $key, 'post', array( 'label' => $name ) );
  • I am working on a theme that I plan to sell and would like NOT to force the end user into my preset naming conventions. I'd like the theme to be as flexible as possible. So with your solution, I could add that snippet to the functions.php file, and in my theme documentation, state that they add the custom taxonomy names BEFORE applying the theme? Or is that asking too much of the end user? Or... Would it be possible to hold off the registration of the taxonomies until the end user checks a checkbox in the theme options panel, grabs their custom names, and drop them in the $taxonomies array?
    – dvieira
    Commented Jan 18, 2013 at 18:02
  • taxonomies are registered on every request, so if the option is not yet set they won't exist until the user creates them. they would be free to create (or remove) them at any point after the theme is activated. this is a very basic example, you'll probably also want to expand this to accommodate more than a simple name, like provide the ability to set them to hierarchical or non-hierarchical, slug, etc.. take a look in the plugins repository at post type/taxonomy creation plugins for examples of how other developers handle the UI and code for this sort of thing.
    – Milo
    Commented Jan 18, 2013 at 19:06

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.