How to register Taxonomies in custom post or WordPress default post

Shortlink:

Hello, Today i will teach you How to register Taxonomies in custom post or WordPress default post in your WordPress website, it’s simple work,

You can see How to register custom post types in WordPress

Open Your functions.php file in your current active theme then you can copy below codes and past in your functions.php file.

function custom_post_taxonomy() {

register_taxonomy(
'tab_category',  //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
'testimonial',                  //post type name
array(
'hierarchical'          => true,
'label'                         => 'Tab Category',  //Display name
'query_var'             => true,
'show_admin_column'             => true,
'rewrite'                       => array(
'slug'                  => 'tab-category', // This controls the base slug that will display before each term
'with_front'    => true // Don't display the category base before
)
)
);


}
add_action( 'init', 'custom_post_taxonomy');

Function Reference

Register Taxonomy

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!




%d bloggers like this: