Welcome to Findnerd. We are using wordpress function named register_taxonomy to create a new custom taxonomy. There are many in-bulid taxonomies like categories,tags and Link categories. This functions takes three parameters. First one is name of the taxonomy. it must be in lower case letters and not more than 32 characters. second one is the object type which can be post,revision,page,attchment ,nav_menu_item and custom post type as well. Last one is the array of different elements. last parameter array includes different elements like label,public,query_vars,rewrite etc. Let's take an simple example.
add_action( 'init', 'build_your_taxonomy' );
function build_your_taxonomy() {
register_taxonomy(
'mytest',
'post',
array(
'label' => 'myway',
'hierarchical' => true,
)
);
In above example we build a taxonomy for post with name mytest and passed the arguments like hierachical and label. It will create a new taxonomy for post like category.
0 Comment(s)