4

I was wondering if someone can help me with this. I'm currently following Shibashake's tutorial about creating custom meta-boxes that include taxonomy selection here: http://shibashake.com/wordpress-theme/wordpress-custom-taxonomy-input-panels . They show how to remove the standard metabox Wordpress automatically creates for taxonomies using the remove_meta_box function. Only problem is that the function for some reason doesn't seem to work on taxonomies that work as categories ie ones where the hierarchical option is set to true. I know I have the function working because the ones set up as tags disappear easily enough. I can't if it just isn't possible or if there is something special I need to add in one of the parameters to make it work.

Example:

$args = array( 
    'hierarchical' => false,  
    'label' =>'People',  
    'query_var' => true,  
    'rewrite' => true       
);
register_taxonomy('people', 'post',$args);

remove_meta_box('tagsdiv-people','post','side');

That works fine. If I set hierarchical to 'true, however, the meta box stays put.

Can anyone shed some light?

1
  • wow, thanks. All it does is add a 'div' to the end of the taxonomy slug. For example, if the taxonomy's slug was 'people', the name of the metabox would be called 'peoplediv'. Works like a charm. You should have posted this as an answer. Jan 1, 2011 at 2:50

1 Answer 1

7

Non-hierarchical taxonomies (like tags) use tagsdiv-{$tax_name}. Hierarchical taxonomies (like categories) use {$tax_name}div.

This is for historical reasons: categories were placed in categorydiv, tags in tagsdiv. When support for multiple non-hierarchical taxonomies was added, the tagsdiv name was expanded to tagsdiv-{$tax_name}. When finally multiple hierarchical taxonomies were made possible, they choose to generalize categorydiv to {$tax_name}div.

3
  • 1
    It was a fun thing to research where the difference came from. And welcome to the site @Manny, I hope we'll see more good questions and answers from you!
    – Jan Fabry
    Jan 2, 2011 at 0:06
  • Thanks. I hope I can get to the point where I give good answers myself. I already love how friendly this community is and how much I can learn from others' questions. Jan 2, 2011 at 2:26
  • @MannyFleurmond & Jan : great Q&A and comment exchange - just checked and it was Manny 2nd question in the site, a toast is needed: beers for all and cheers both :)
    – brasofilo
    May 31, 2012 at 20:39

Your Answer

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

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