Monday 22 June 2015

How To Add Taxonomy In Multiple Post In Wordpress

Hello

Some Time Same Taxonomy use in multiple post. for example onw taxonomy like music

I Want to use multiple post like WordPress default post,musician,or another post.

I have Solution for that check below code

<?php
register_taxonomy('music',array('musician','post','page'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'music' ),
  ));
?>

here  music is your taxonomy name. in your array add your post i have added post,musician,page etc

this code add to your theme in function.php or plugin file.

that can be worked

No comments:

Post a Comment

Thank You For Comment