I have create a custom post type named “jobs”, and I want to create a set of category for that, ie like “PHP Jobs”, “Python Jobs” etc.
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'exclude_from_search' => false,
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 2,
'taxonomies' => array( 'post_tag', "category"),
'menu_icon' => WJ_PLUGIN_URL .'/images/admin_menu_icons.png',
);
register_post_type('jobs', $args);
But this is nt listing that category or I can’t assign a new post to that category.
While $post = wp_insert_post( $post, false );
I tried this also.
$args = array(
..
..
..
'taxonomies' => array( 'post_tag', "job_category"),
register_taxonomy( 'job_category', 'jobs', array( 'hierarchical' => true, 'label' => 'Jobs Categories', 'query_var' => true, 'rewrite' => true ) );
No effect.
You could create a taxonomy called Job Types and your terms would be PHP Jobs etc.
In your register post type function change:
'taxonomies' => array( 'post_tag', "category"),
to
'taxonomies' => array('job_types'),