I created a Custom Post Type , but now I can not create categories that are only seen for this CPT.
When you add 'taxonomies' => array('category')
, it displays all categories. How can I resolve this?
I created a Custom Post Type , but now I can not create categories that are only seen for this CPT.
When you add 'taxonomies' => array('category')
, it displays all categories. How can I resolve this?
I used the following code before the register_post_type and it worked! It is there for those who have the same doubt.
register_taxonomy( 'images',
array('images'), /* This is the name of your custom post type, I used "Images" */
array('hierarchical' => true, /* if this is true it acts like categories */
'labels' => array(
/* OPTIONS */
),
'show_ui' => true,
'query_var' => true,
)
);
register_post_type( 'images',
array(
'labels' => array(
'name' => __( 'Images' ),
'singular_name' => __( 'images' ),
'add_new' => __('New', 'Image'),
),
'public' => true,
'capability_type' => 'post',
'rewrite' => array('slug' => 'images/test','with_front' => FALSE)
)
);
For those who did not understand the solution:
The problem was with using a taxonomy reserved by WordPress, in the category case, using images worked normally.