Here is an example of registering a “people” taxonomy
function people_init() {
// create a new taxonomy
register_taxonomy (
'people',
'post',
array(
'label' => _('people'),
'rewrite' => array('slug' => 'person'),
'capabilities' => array(
'assign_terms' => 'edit_guides',
'edit_terms' => 'publish_guides',
)
)
);
}
add_action('init', 'people_init');
Here is an example of adding the term John to post id number 555 in the "person" taxonomy
wp_set_object_terms(555, 'John', 'person');
Comments (0)