Filter Categories in meta box for CPTs

Question

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.

0
redcenter 5 months 2020-12-21T09:10:22-05:00 0 Answers 6 views 0

Leave an answer

Browse
Browse