Support » Fixing WordPress » Custom Post Types & meta boxes – Am I missing something?

  • Drew Jaynes


    WordPress Core Developer

    So, I understand adding custom post types and custom taxonomies via functions.php. There are two things I don’t understand though.`

    First, here’s what I’m working with.

    register_taxonomy('blog_cats', 'post', array(
    'hierarchical' => true,  'label' => 'Blog Categories',
    'query_var' => true, 'rewrite' => true));
    add_action( 'init', 'create_my_post_types' );
    function create_my_post_types() {
    	register_post_type( 'blog_posts',
    			'labels' => array(
    				'name' => __( 'Blog Posts' ),
    				'singular_name' => __( 'Blog Post' )
    			'public' => true,
    			'description' => __( 'Blog posts post type.' ),
    			'menu_position' => 5,
    			'taxonomies' => array( 'post_tag', 'blog_cats'),
    			'can_export' => true

    If my understanding is right, the following part should add the tags meta box to my Blog Post edit/publish page:

    'taxonomies' => array( 'post_tag', 'blog_cats'),

    It doesn’t. Doesn’t work for ‘category’ either. What gives?


    The second thing I’m not getting is that custom taxonomies are automatically added in the form of meta boxes to the baked-in post edit/publish page. That’s just fine in some cases, but what if I want to remove some of the meta boxes attached to custom taxonomies? A good example is derived from the above code example. I don’t need both categories and blog categories for regular posts. Thoughts?

    Maybe these screencaps will help illustrate the point:

    View post on

    View post on

Viewing 4 replies - 1 through 4 (of 4 total)
  • Register your taxonomy inside the function with the post type (prior to the post type).

    Both post types and taxonomies need to be registered at init.

    If that’s still problematic, try the action with a higher priority..


    add_action( 'init', 'create_my_post_types', 0 );

    Drew Jaynes


    WordPress Core Developer


    Thank you! It was getting late and I knew something was amiss, I’m glad somebody had the answer to this.

    Turns out, this worked great out of the box on my second less-modded install. On the first install, using a WooThemes theme, I had to place the function in another included functions file.

    Either way, thank you very much sir!

    Drew Jaynes


    WordPress Core Developer

    Strike that, *sigh*.

    Deactivating plugins to find the conflict. Thanks for all your help.

    **Update: Weird. I deactivated plugins and reactivated one by one. Tags meta box is showing up with the same plugins activated now. Odd.

    Glad to hear you have everything working… and happy i could help… 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post Types & meta boxes – Am I missing something?’ is closed to new replies.