admin管理员组

文章数量:1313795

Working with a custom post type in Wordpress, I would like to use the categories. So I added the categories to the cpt. No problems here.

But, when adding or editing cpt items, I would like to filter the categories they can choose from.

Currently it shows all categories. But I want to show only specific categories (or categories below a specific parent category).

FYI: A special taxonomy for the cpt is not an option in my use case.

I cannot find a filter / action I could use to filter all categories shown on a edit page for a specific CPT.

Example of the situation

A custom-post-type named 'Books'. Normal Wordpress categories: 'category A', 'category B', 'subcategory A-1', 'subcategory A-2'

When editing a 'Book', I want the category select box to show: 'subcategory A-1', 'subcategory A-2'. And omit all other categories.

All help is appreciated.

本文标签: Filter Categories in meta box for CPTs