How to Add Categories and Tags to Pages in WordPress


Categories
Tags
Natively, you can categorise and tag your Wordpress posts with the readily available category and tag taxonomies. Learn how to add that same functionality to pages.

This one is very straightforward, simply add the below code to your functions file.

function register_additional_taxonomies() {  
	// Add tag metabox to pages
	register_taxonomy_for_object_type('post_tag', 'page');
	
	// Add category metabox to pages
	register_taxonomy_for_object_type('category', 'page');  
}
 // Add to the admin_init hook
add_action( 'init', 'register_additional_taxonomies' );

Go to a page in your WordPress admin area and you should now see the ‘Categories’ and ‘Tags’ metaboxes when editing your page (same as you do on your posts). If not, check that categories and tags are checked in the screen options (you might just need to tick the appropriate screen elements for them to display in your editing panel, as this is customisable to the user and may be unchecked).

Comments

Whether you have feedback, a question, want to share your opinion, or simply want to say thank you - we welcome comments! Please read the disclaimer.

Disclaimer and Legal Information

The use of any content found on or via this website (code, how to guides etc.) is done so at your own risk. We take no responsibility for any issues encountered.

This blog and its authors will not be held responsible for any misuse, reuse, recycled and cited/uncited copies of content from this website by others.

The views and opinions expressed in this blog are those of the author(s) and do not necessarily reflect the position or opinion of any other agency, organisation, employer or company.

Comments are moderated but we do not take any responsibility for any libel or litigation that results from something written in a comment. We reserve the right to reject or delete any comment for any reason whatsoever (abusive, profane, rude etc). Please keep your comments polite and relevant.

We are happy for you to quote and share our content in any reasonable manner, e.g. post links to our blogs on social media, but not in any way that suggests that we, or our authors, endorse you, your use or your views. Nothing negative please.

We appreciate attributions, e.g. a link to our website (www.dragoncode.co.uk).

Thank you – we hope you find the website useful.