0
votes

Good day all :)

I'm using a custom post type (publicite) which also uses a custom taxonomy (business_category). Whenever I add a new post (publicite), I see that custom taxonomy metabox on the right side but I want it moved to the middle. So I started by removing the metabox with the following code:

remove_meta_box('business_categorydiv', 'publicite', 'side');

After reading online, it seems like I have to use the following line of code to add it again (or so I thought):

add_meta_box('business_categorydiv', __('Catégories'), 'post_categories_meta_box', 'publicite', 'normal', 'high');

The problem with it, is that it adds the default post category metabox (not the custom taxonomy one). I tried many things (like the one below) but none seem to work:

add_meta_box('business_categorydiv', __('Catégories'), 'post_business_category_meta_box', 'publicite', 'normal', 'high');

Any idea how this can be achieved?

1
Bingo! I had to supply an argument at the end like so: add_meta_box('business_categorydiv', __('Catégories', 'wp-custom-posts'), 'post_categories_meta_box', 'publicite', 'normal', 'high', array('taxonomy' => 'business_category'));Yannick T.
You should post your comment as an answer and accept it, to make sure future "passers by" will benefit from your solution :-)Erenor Paz

1 Answers

3
votes

Bingo! I had to supply an argument at the end like so:

add_meta_box('business_categorydiv', __('Catégories', 'wp-custom-posts'), 'post_categories_meta_box', 'publicite', 'normal', 'high', array('taxonomy' => 'business_category'));