• Ading a new Custom Post type I need to have the existing category and post_tag taxonomies. My code is here

    register_post_type('im_directory', array(
    	'label' => __('Directory'),
    	'singular_label' => __('Directory'),
    	'public' => true,
    	'show_ui' => true, // UI in admin panel
    	'_builtin' => false, // It's a custom post type, not built in!
    	'_edit_link' => 'post.php?post=%d',
    	'capability_type' => 'post',
    	'hierarchical' => true,
    	'supports' => array('title','editor','thumbnail','excerpt'),
    	'rewrite' => array("slug" => "directory"),
    	'taxonomies' => array('post_tag','category'),
    	'menu_position' => 5
    ));

    The problem is that I am not seeing the Category and Tag when I go to add a new post. Any ideas?

Viewing 1 replies (of 1 total)
  • Where are you placing this code?

    The post type needs to be registered on init..

    add_action( 'init', 'register_my_post_type' );
    function register_my_post_type() {
    	register_post_type( 'im_directory', array(
    		'label' => __('Directory'),
    		'singular_label' => __('Directory'),
    		'capability_type' => 'post',
    		'hierarchical' => true,
    		'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
    		'rewrite' => array( "slug" => "directory" ),
    		'taxonomies' => array( 'post_tag', 'category' ),
    		'menu_position' => 5
    	) );
    }

    NOTE: I removed some args, there’s no need to include them when you’re using the default value for a given arg.

    If that’s still problematic, try changing the action priority..

    Higher value – Lower priority

    add_action( 'init', 'register_my_post_type', 1000 );

    Lower value – Higher priority

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

    Hope that helps.. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type Taxonomies’ is closed to new replies.