Tags

, , ,

We have function that adds an already registered taxonomy to a custom object type.
Suppose we need to add the same categories and tags we use with posts to our Pages.

Here’s how we do it:

register_taxonomy_for_object_type( 'category', 'post' );
register_taxonomy_for_object_type( 'post_tag', 'post' );

add this code in function.php file

function addcategory_settings() {  
register_taxonomy_for_object_type( 'category', 'page' );
register_taxonomy_for_object_type( 'post_tag', 'page' ); 
}
add_action( 'init', 'addcategory_settings' );

Untitled-1

Advertisements