How to Add Categories and Tags for WordPress Pages

By default, WordPress doesn’t associate any taxonomy with pages. However, you can easily add default tag and category taxonomies to pages.

Read Also: Applying Categories, Tags and Custom Taxonomies to Media Attachments

Paste the following code into your functions.php file to add categories and tags to WordPress pages.

function ccw_add_category_and_tag_to_pages() {
	//add tags to pages
	register_taxonomy_for_object_type( 'post_tag', 'page' );
	//add categories to pages
	register_taxonomy_for_object_type( 'category', 'page' );
}
add_action( 'init', 'ccw_add_category_and_tag_to_pages' );

We are using register_taxonomy_for_object_type function to perform this task.

Leave a Comment.