The other day, I needed to add categories and tags to pages on one of my WordPress sites. Like many, I thought, "Aren't categories and tags just for blog posts?" It turns out that adding them to pages can be pretty useful.
Categories and tags help organise content. Categories are broad groups that link similar topics, while tags are specific labels that connect content, sharing something in common. We often use them for blog posts, but there's no reason pages can't benefit too.
Think about pages for services, guides, or events. Adding categories and tags can make things more organised and easier for visitors to find. It also helps search engines understand your site's structure better. Visitors can easily explore related content, improving their experience on your site.
In this post, I'll show you how to add categories and tags to WordPress pages, just like I did for my own site.
Categories group content into broader topics, like sections in a library: Fiction, Non-Fiction, etc. Tags, meanwhile, are keywords that help connect individual pieces of content. Categories are usually hierarchical—you can have subcategories—while tags are not. Together, they allow visitors to find content more efficiently and make it easier for search engines to understand your site.
WordPress usually limits categories and tags to posts, which makes sense if you run a blog. But if you have many pages about different topics, like services or guides, adding categories and tags can be just as helpful. It gives your pages the same organisation level as posts, making navigating and finding related content easier for visitors.
Adding categories and tags to pages can improve navigation for visitors. It makes finding what they're looking for easier, leading to a better user experience. It also helps keep your content well-organised, grouping pages by relevant topics. This kind of organisation benefits search engines, too, which can lead to better SEO rankings.
Before making changes, use a child theme or site-specific plugin to avoid losing edits during theme updates.
Add this to your theme's functions.php file:
function add_categories_to_pages() {
register_taxonomy_for_object_type('category', 'page');
}
add_action('init', 'add_categories_to_pages');
Add this code:
function add_tags_to_pages() { register_taxonomy_for_object_type('post_tag', 'page'); } add_action('init', 'add_tags_to_pages');
To add both in one step:
function add_taxonomies_to_pages() { register_taxonomy_for_object_type('category', 'page'); register_taxonomy_for_object_type('post_tag', 'page'); } add_action('init', 'add_taxonomies_to_pages');
Make sure meta boxes for categories and tags appear in the page editor:
function add_taxonomy_meta_boxes_to_pages() { add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'page', 'side', 'default'); add_meta_box('tagsdiv-post_tag', __('Tags'), 'post_tags_meta_box', 'page', 'side', 'default'); } add_action('admin_init', 'add_taxonomy_meta_boxes_to_pages');
If you prefer not to edit theme files, create a plugin.
Navigate to wp-content/plugins/, create a folder named page-taxonomies, and a file called page-taxonomies.php inside it.
Add this code to page-taxonomies.php:
<?php /** * Plugin Name: Page Taxonomies * Description: Enables categories and tags for pages. * Version: 1.0 * Author: Your Name */ if ( ! defined( 'ABSPATH' ) ) { exit; } function pt_add_taxonomies_to_pages() { register_taxonomy_for_object_type('category', 'page'); register_taxonomy_for_object_type('post_tag', 'page'); } add_action('init', 'pt_add_taxonomies_to_pages'); function pt_add_taxonomy_meta_boxes_to_pages() { add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'page', 'side', 'default'); add_meta_box('tagsdiv-post_tag', __('Tags'), 'post_tags_meta_box', 'page', 'side', 'default'); } add_action('admin_init', 'pt_add_taxonomy_meta_boxes_to_pages');
Log in to WordPress, go to Plugins > Installed Plugins, find Page Taxonomies, and activate it.
Displaying Categories and Tags on Pages
Add the following to your page.php template within the WordPress Loop to show categories or tags on pages.
Display Categories:
$categories = get_the_category(); if ( ! empty( $categories ) ) { echo '<div class="page-categories"><strong>Categories:</strong> '; foreach( $categories as $category ) { echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a>, '; } echo '</div>'; }
$tags = get_the_tags(); if ( ! empty( $tags ) ) { echo '<div class="page-tags"><strong>Tags:</strong> '; foreach( $tags as $tag ) { echo '<a href="' . esc_url( get_tag_link( $tag->term_id ) ) . '">' . esc_html( $tag->name ) . '</a>, '; } echo '</div>'; }
Plugins are available that add categories or tags to pages without needing to code, but keep in mind that plugins can add bloat and slow down your site.
If categories and tags aren't showing up, it might be due to a theme or plugin conflict. Try deactivating plugins one at a time to see if the issue resolves, or switch to a default theme to check compatibility.