CPT Recipe – Taxonomy Tags
if ( ! function_exists( 'wpbscook_register_taxonomy_recipe_tags' ) ) {
// Register Custom Taxonomy
function wpbscook_register_taxonomy_recipe_tags() {
$labels = array(
'name' => _x( 'Tags', 'Taxonomy General Name', 'wpbscook' ),
'singular_name' => _x( 'Tag', 'Taxonomy Singular Name', 'wpbscook' ),
'menu_name' => __( 'Tags', 'wpbscook' ),
'all_items' => __( 'All tags', 'wpbscook' ),
'parent_item' => __( 'Parent tag', 'wpbscook' ),
'parent_item_colon' => __( 'Parent tag:', 'wpbscook' ),
'new_item_name' => __( 'New tag name', 'wpbscook' ),
'add_new_item' => __( 'Add new tag', 'wpbscook' ),
'edit_item' => __( 'Edit tag', 'wpbscook' ),
'update_item' => __( 'Update tag', 'wpbscook' ),
'separate_items_with_commas' => __( 'Separate tags with commas', 'wpbscook' ),
'search_items' => __( 'Search tags', 'wpbscook' ),
'add_or_remove_items' => __( 'Add or remove tags', 'wpbscook' ),
'choose_from_most_used' => __( 'Choose from the most used tags', 'wpbscook' ),
'not_found' => __( 'Not Found', 'wpbscook' ),
);
$rewrite = array(
'slug' => 'recipe_tag',
'with_front' => true,
'hierarchical' => false,
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'rewrite' => $rewrite,
);
register_taxonomy( 'wpbscook_tags', array( 'wpbscook_recipe' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'wpbscook_register_taxonomy_recipe_tags', 0 );
}