How to Create taxonomy using ‘null’ for $object_type?

I tried creating a taxonomy using null for object type so that I can enable it for my suitable post types.

add_action( ‘init’, ‘create_pricat’ );

function create_pricat() {

$labels = array(
‘name’ => _x( ‘Pricat’, ‘taxonomy general name’, ‘textdomain’ ),
‘singular_name’ => _x( ‘Pricat’, ‘taxonomy singular name’, ‘textdomain’ ),
‘search_items’ => __( ‘Search Pricat’, ‘textdomain’ ),
‘all_items’ => __( ‘All Pricat’, ‘textdomain’ ),
‘parent_item’ => __( ‘Parent Pricat’, ‘textdomain’ ),
‘parent_item_colon’ => __( ‘Parent Pricat:’, ‘textdomain’ ),
‘edit_item’ => __( ‘Edit Pricat’, ‘textdomain’ ),
‘update_item’ => __( ‘Update Pricat’, ‘textdomain’ ),
‘add_new_item’ => __( ‘Add New Pricat’, ‘textdomain’ ),
‘new_item_name’ => __( ‘New Pricat Name’, ‘textdomain’ ),
‘menu_name’ => __( ‘Pricat’, ‘textdomain’ ),
);

$args = array(
‘labels’ => $labels,
‘hierarchical’ => false,
‘publicly_queryable’ => false,
‘rewrite’ => false,
);
}

register_taxonomy( ‘pricat’, null, $args );

But it got error on add_rewrite_tag() because of null object type.

Now, How do I create a taxonomy using null $object_type?

Read more here:: How to Create taxonomy using ‘null’ for $object_type?

Leave a Reply

Your email address will not be published. Required fields are marked *