I'd like to create a custom taxonomy called "Tags", just like the native one that can be found on Posts, with the same name/slug but independent from it:
'taxonomies' => array('post_tag')
I know that I can add the line above during the CPT creation but this would make the Tags shared between posts and my CPT. That is something I'd like to avoid so I wanted to use the following code:
$labels = array(
'name' => _x( 'Tags', 'taxonomy general name', 'textdomain' ),
'singular_name' => _x( 'Tag', 'taxonomy singular name', 'textdomain' ),
'search_items' => __( 'Search Tags', 'textdomain' ),
'popular_items' => __( 'Popular Tags', 'textdomain' ),
'all_items' => __( 'All Tags', 'textdomain' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Tag', 'textdomain' ),
'update_item' => __( 'Update Tag', 'textdomain' ),
'add_new_item' => __( 'Add New Tag', 'textdomain' ),
'new_item_name' => __( 'New Tag Name', 'textdomain' ),
'separate_items_with_commas' => __( 'Separate tags with commas', 'textdomain' ),
'add_or_remove_items' => __( 'Add or remove tags', 'textdomain' ),
'choose_from_most_used' => __( 'Choose from the most used tags', 'textdomain' ),
'not_found' => __( 'No tags found.', 'textdomain' ),
'menu_name' => __( 'Tags', 'textdomain' ),
);
$args = array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'tag' ),
);
register_taxonomy( 'tag', 'book', $args );
My doubt is that at the bottom of the official "Register Taxonomy Page" there is a section dedicated to "Reserved Terms" and, among them, there's also "tag".
So my question is, how do I change the code written above to better comply with the Wordpress guidelines and avoid potential conflicts?
The "reserved terms" refers only to the "register_taxonomy()" function or also the 'rewrite' argument? Can I change the name of the "registered taxonomy" but keep the 'rewrite' => array( 'slug' => 'tag' ) ? Would this potentially generate conflicts?
Is enough to change the "register_taxonomy" into:
register_taxonomy( 'book_tag', 'book', $args );
but keep unchanged
'rewrite' => array( 'slug' => 'tag' )
Would this be a correct way of handling this and avoid any conflict? Is there a better way?
Thanks for your time and support