Creating custom taxonomy for WordPress to specific post type
- by admin
- 0
Add below code inside function.php
add_action( ‘init’, ‘taxonomy_create’);
function taxonomy_create() {
register_taxonomy(
‘imagecategories’, // category name
‘imageslider’, // post type slug name
array(
‘hierarchical’ => true,
‘label’ => ‘Image categories’ // label for that category
)
);
}
Add below code inside function.php add_action( ‘init’, ‘taxonomy_create’); function taxonomy_create() { register_taxonomy( ‘imagecategories’, // category name ‘imageslider’, // post type slug name array( ‘hierarchical’ => true, ‘label’ => ‘Image categories’ // label for that category ) ); }
Add below code inside function.php add_action( ‘init’, ‘taxonomy_create’); function taxonomy_create() { register_taxonomy( ‘imagecategories’, // category name ‘imageslider’, // post type slug name array( ‘hierarchical’ => true, ‘label’ => ‘Image categories’ // label for that category ) ); }