I've created the following custom post type:
/**
* Register hire custom post type
*/
function hire() {
$labels = array(
'name' => _x( 'Hire Products', 'Post Type General Name', 'fire' ),
'singular_name' => _x( 'Hire Product', 'Post Type Singular Name', 'fire' ),
'menu_name' => __( 'Hire Products', 'fire' ),
'name_admin_bar' => __( 'Hire Products', 'fire' ),
'archives' => __( 'Item Archives', 'fire' ),
'parent_item_colon' => __( 'Parent Item:', 'fire' ),
'all_items' => __( 'All Items', 'fire' ),
'add_new_item' => __( 'Add New Item', 'fire' ),
'add_new' => __( 'Add New', 'fire' ),
'new_item' => __( 'New Item', 'fire' ),
'edit_item' => __( 'Edit Item', 'fire' ),
'update_item' => __( 'Update Item', 'fire' ),
'view_item' => __( 'View Item', 'fire' ),
'search_items' => __( 'Search Item', 'fire' ),
'not_found' => __( 'Not found', 'fire' ),
'not_found_in_trash' => __( 'Not found in Trash', 'fire' ),
'featured_image' => __( 'Featured Image', 'fire' ),
'set_featured_image' => __( 'Set featured image', 'fire' ),
'remove_featured_image' => __( 'Remove featured image', 'fire' ),
'use_featured_image' => __( 'Use as featured image', 'fire' ),
'insert_into_item' => __( 'Insert into item', 'fire' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'fire' ),
'items_list' => __( 'Items list', 'fire' ),
'items_list_navigation' => __( 'Items list navigation', 'fire' ),
'filter_items_list' => __( 'Filter items list', 'fire' ),
);
$args = array(
'label' => __( 'Hire Product', 'fire' ),
'description' => __( 'Custom post type for hire products.', 'fire' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'page-attributes', ),
'taxonomies' => array('hire_taxonomies'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'hire', $args );
}
add_action( 'init', 'hire', 0 );
I've also created the following code to enable taxonomies for my custom post type:
/**
* Hire taxonomies
*/
function hire_taxonomies() {
$labels = array(
'name' => _x( 'Categories', 'Taxonomy General Name', 'fire' ),
'singular_name' => _x( 'Category', 'Taxonomy Singular Name', 'fire' ),
'menu_name' => __( 'Categories', 'fire' ),
'all_items' => __( 'All Items', 'fire' ),
'parent_item' => __( 'Parent Item', 'fire' ),
'parent_item_colon' => __( 'Parent Item:', 'fire' ),
'new_item_name' => __( 'New Item Name', 'fire' ),
'add_new_item' => __( 'Add New Item', 'fire' ),
'edit_item' => __( 'Edit Item', 'fire' ),
'update_item' => __( 'Update Item', 'fire' ),
'view_item' => __( 'View Item', 'fire' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'fire' ),
'add_or_remove_items' => __( 'Add or remove items', 'fire' ),
'choose_from_most_used' => __( 'Choose from the most used', 'fire' ),
'popular_items' => __( 'Popular Items', 'fire' ),
'search_items' => __( 'Search Items', 'fire' ),
'not_found' => __( 'Not Found', 'fire' ),
'no_terms' => __( 'No items', 'fire' ),
'items_list' => __( 'Items list', 'fire' ),
'items_list_navigation' => __( 'Items list navigation', 'fire' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'hire_taxonomies', array( 'hire' ), $args );
}
add_action( 'init', 'hire_taxonomies', 0 );
When I go to WP admin, the "Categories" tab appears under my custom post type. I've created some categories for that custom post type, but they don't show up when I go to wrote a post under that custom post type.
What am I missing here?