0

Is it possible to restrict category availability, so that only specific categories are available in the category metabox on the edit post screen of a specific post type?

Example: can a category of 'foo' be available on the edit screen for a specific cpt - but not the edit screen of regular posts?

(I already have a custom taxonomy for cpts, but am wondering if some but not all normal post categories can be available. This isn't purely an academic question, it has practical use.)

3
  • If it is not an "academic" question but practical, please share the use case.
    – cybmeta
    Commented Aug 11, 2016 at 7:10
  • @cybmeta I use a third-party app which can apply bulk protection to categories but not (without paid modification) custom taxonomies.
    – gulliver
    Commented Aug 11, 2016 at 10:00
  • Sorry but I don't understand your "use case", that is the limitation of a third party software, not the use case.
    – cybmeta
    Commented Aug 11, 2016 at 10:13

1 Answer 1

2

Either the taxonomy is common, or it is not. In other words, you may have books and movies CPTs that have an author taxonomy for their authors (lets say screen play in case of movies, to make it real). In the real world there is no much sense to say that "mark" can be an author of a book, but not a movie.

If you want to have a virtual author "hhhh" that can be associated only with books but not with movies, then it is not a real author and the best way to indicate that is to have a separate "virtual author" taxonomy.

Translating to your question.... sounds like you have categories which are not content categories, and therefor do not belong there in the first place, and should be a different taxonomy or meta data

3
  • I don't use categories in normal posts/pages - everything is assigned to a default 'misc'. For one project using a third-party app which can apply bulk protection to categories but not (without paid modification) custom taxonomies, I wanted to make selected categories available to a CPT. Having only selected categories available reduces chance of an item being assigned to an inappropriate category. I can use css to hide the unwanted categories, but prefer a non-css workaround.
    – gulliver
    Commented Aug 11, 2016 at 10:05
  • Totally agree with @MarkKaplun, it seems to me that you are trying to force a content structure and classification conceptually wrong, and therefore, trying to force the classification and content management system to work in a way it was not intended. That is why I'm asking for the description of the use case. I suggest you to rethink the content structure in your website.
    – cybmeta
    Commented Aug 11, 2016 at 10:14
  • @gulliver, your 3rd party app sucks, ask the developers to properly use meta data instead of categories for that kind of use.categories are for content classification, not for cost classification Commented Aug 11, 2016 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.