I’m looking all over google but doesn’t find the way to do it.
i’ve declared a custom post type (let’s say ‘job’) with a custom hierarchical taxonomy (‘activities’).
I would also like to assign “normal” tags to my custom post type (if i have a tag ‘full employment’ for my classic posts, i want to assign to my job posts also).
how can i achieve that ?
i managed to have a custom taxonomy on several post types, but i don’t know how to target post_tag and add him a post type.
for example :
register_taxonomy( 'seasons', array('job', 'post'), $args );
make seasons appear on classic posts and also on job posts. I would like to have ‘tags’ available for my job posts.
am i clear ?
thanks,
1 Answer
Enabling tags in a custom post type is quite simple. You need to use 'taxonomies' => array('post_tag')
while calling register_post_type()
.
For Example:
register_post_type('movies',
array(
'labels' => array(
'name' => 'Movies',
'singular_name' => 'Movie',
'menu_name' => 'MOVIES',
'all_items' => 'All Movies',
'add_new' => 'Add A Movie',
'add_new_item' => 'Add New Movie'
),
'public' => true,
'supports' => array(
'title',
'post-formats',
),
'show_in_admin_bar' => true,
'taxonomies' => array('post_tag'),
)
);
Look for the last taxanomies => array('post_tag')
in code. This is how you enable tags in a custom post type.