Reputation: 287
I am trying to create a custom post type with taxonomy. When I activate my plugin I see all categories of post on dashboard. But I display only taxonomy categories not post categories.
function propertyinfo_setup_post_types() {
$PROPERTY_labels = apply_filters( 'propertyinfo_labels', array(
'name' => 'Property Info',
'singular_name' => 'Property Info',
'add_new' => __('Add New', 'propertyinfo'),
'add_new_item' => __('Add New Property', 'propertyinfo'),
'edit_item' => __('Edit Property Info', 'propertyinfo'),
'edit_item' => __('Edit Property Info', 'propertyinfo'),
'new_item' => __('New Property Info', 'propertyinfo'),
'all_items' => __('All Property', 'propertyinfo'),
'view_item' => __('View Property', 'propertyinfo'),
'search_items' => __('Search Propertys', 'propertyinfo'),
'not_found' => __('No Propertys found', 'propertyinfo'),
'not_found_in_trash' => __('No Propertys found in Trash', 'propertyinfo'),
'parent_item_colon' => '',
'menu_name' => __('Property Info', 'propertyinfo'),
'exclude_from_search' => true
) );
$PROPERTY_args = array(
'labels' => $PROPERTY_labels,
'public' => true,
'taxonomies' => array('category',),
'publicly_queryable'=> true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'supports' => apply_filters('propertyinfo_supports', array( 'title', 'editor','thumbnail','author') ),
);
register_post_type( 'propertyinfo', apply_filters( 'propertyinfo_post_type_args', $PROPERTY_args ) );
}
add_action('init', 'propertyinfo_setup_post_types');
Upvotes: 0
Views: 164
Reputation:
Register taxonomy is different.
add this code and remove taxonomies' => array('category')
from property args.
register_taxonomy("main_title", array("Property Info"), array("hierarchical" => true, "label" => "cat_lable", "singular_label" => "singular_label", "rewrite" => true));
Upvotes: 1