You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在WordPress中仅为页面创建并分配专属分类?

Got it, let's tackle this issue—you want to add categories to WordPress Pages without them showing up in Posts, right? The problem with some solutions (including the plugin you tried) is that they just attach the default Post Categories taxonomy to Pages, which is why they sync up. Here are a few reliable ways to fix this:

How to Add Categories to WordPress Pages Without Syncing with Posts

1. Register a Custom, Page-Only Taxonomy (Most Reliable Method)

The cleanest way is to create a completely separate taxonomy just for Pages—this way, it won't share any data with Post Categories. You can add this code to your theme's functions.php file or a custom plugin (using a custom plugin is safer, since theme updates won't overwrite it):

// Register a dedicated taxonomy for WordPress Pages
function register_page_categories() {
    $taxonomy_labels = array(
        'name'              => 'Page Categories',
        'singular_name'     => 'Page Category',
        'search_items'      => 'Search Page Categories',
        'all_items'         => 'All Page Categories',
        'parent_item'       => 'Parent Page Category',
        'parent_item_colon' => 'Parent Page Category:',
        'edit_item'         => 'Edit Page Category',
        'update_item'       => 'Update Page Category',
        'add_new_item'      => 'Add New Page Category',
        'new_item_name'     => 'New Page Category Name',
        'menu_name'         => 'Page Categories',
    );

    $taxonomy_args = array(
        'labels'            => $taxonomy_labels,
        'hierarchical'      => true, // Enable parent/child categories like default Posts
        'public'            => true,
        'show_ui'           => true,
        'show_admin_column' => true, // Show category column in Pages list
        'query_var'         => true,
        'rewrite'           => array( 'slug' => 'page-category' ), // Custom URL slug for archives
    );

    register_taxonomy( 'page_category', 'page', $taxonomy_args );
}
add_action( 'init', 'register_page_categories' );

After adding this code:

  • You'll see a new "Page Categories" menu in your WordPress admin, right alongside Posts and Pages.
  • Go to Settings > Permalinks and click "Save Changes" to refresh your site's URL rules (this ensures the category archive pages work correctly).
  • Now you can assign categories to Pages without them ever showing up in Post Categories.

2. Adjust Your Plugin Usage (If You Prefer Plugins)

The plugin you mentioned is designed to let Pages use the default Post Categories taxonomy—which is exactly why they're syncing. If you want to stick with a plugin, look for one that creates a separate taxonomy for Pages (not just attaches the existing Post Categories). Avoid plugins that share taxonomies between post types if you want complete separation.

3. Custom Fields (Temporary Workaround)

If you just need a quick, temporary way to tag Pages without setting up a full taxonomy, use custom fields:

  • Edit a Page, click the Options menu (three dots in the top right), select Preferences, then check "Custom Fields" under the "Panels" section.
  • Back on the Page editor, scroll down to the "Custom Fields" panel, add a new field (e.g., page_category) and set its value to your category name.
  • Note: This method doesn't give you archive pages or easy filtering like a true taxonomy, so it's only good for simple tagging needs.

内容的提问来源于stack exchange,提问作者Sujeesh S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:40:29