Re-use default categories/tags taxonomies for custom post type? Re-use default categories/tags taxonomies for custom post type? wordpress wordpress

Re-use default categories/tags taxonomies for custom post type?


You can kill two birds with one stone and use the taxonomies key when registering the post type:

$product_labels = array(        'name' => _x('Products', 'post type general name'),        'singular_name' => _x('Product', 'post type singular name'),        'add_new' => _x('Add New', 'portfolio item'),        'add_new_item' => __('Add New Product'),        'edit_item' => __('Edit Product'),        'new_item' => __('New Product'),        'view_item' => __('View Product'),        'search_items' => __('Search Products'),        'not_found' =>  __('Nothing found'),        'not_found_in_trash' => __('Nothing found in Trash'),        'parent_item_colon' => ''    );    $product_args = array(        'labels' => $product_labels,        'public' => true,        'publicly_queryable' => true,        'show_ui' => true,        'query_var' => true,        'rewrite' => array('slug' => 'product'),        'capability_type' => 'post',        'hierarchical' => false,        'menu_position' => 2,        'supports' => array('title','editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions', 'page-attributes', 'custom-fields', ),        // Set the available taxonomies here        'taxonomies' => array('category', 'post_tag')     );    register_post_type('product', $product_args);