Enable Categories on WordPress Pages

Complexity Low
Compatibility WordPress 5.0+

Overview

When using this recipe, you will be able to apply the category taxonomy to your WordPress pages. This functionality will act exactly how WordPress posts work and allow you to sort, categorize and query your pages by category.

Step 1: Add Action to Register Categories on Pages

functions.php
function ssu_add_categories_to_pages() {
    register_taxonomy_for_object_type( 'category', 'page' );
}

add_action( 'init', 'ssu_add_categories_to_pages' );

When initialized, the category taxonomy will be registered for pages.

Usage Ideas

  • Static page content that needs to be categorized