Add Category or Tags For Pages

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s