• Resolved MI

    (@mariukas)


    Hi, everybody,

    I’m using plugin for custom posts (CPT UI). I have 2 custom post types and they are using categories and tags. What I want to do is that each custom post type would have his separate categories. This is example:

    I have two custom post types ‘postA’ and ‘postB’. I have categories ‘test1’, ‘test2’, ‘test3’, ‘test4’. They all are accesible both in postA and postB. What i want to do that ‘postA’ could use only ‘test1’ and ‘test2’ categories / ‘postB’ -> ‘test3’, ‘test4’.

    It is possible? Any ideas how to make it work?

Viewing 6 replies - 1 through 6 (of 6 total)
  • C W (VYSO)

    (@cyril-washbrook)

    You can create custom taxonomies for post types with the register_taxonomy() function. These can be configured so that they behave like categories, but are bound to particular post types. I do not use Custom Post Type UI myself, but it seems that you can create custom taxonomies with the help of this plugin.

    Thread Starter MI

    (@mariukas)

    Tahnks for reply. Yes, I can create taxonomies on CPT UI, but it’s a little bit different thing if you compare with wp categories. The thing is that all the posts are divided to those taxonomies and i can’t get them all shown in one list (like wp posts). So that’s why I want to use categories for this. Or I’m doing something wrong with taxonomies?

    C W (VYSO)

    (@cyril-washbrook)

    I’m not sure what you mean by “posts are divided to those taxonomies”.

    As it is explained on this page, the usual WordPress “categories” are merely a type of taxonomy: namely, they are a so-called hierarchical taxonomy. If you create your own hierarchical taxonomy, it can behave exactly the same way as categories, except connected with a particular custom post type.

    Thread Starter MI

    (@mariukas)

    When i was trying to create my own taxonomy like “custom_categories” that “category” appeared as menu item and the backend user still can’t create categories in add post/edit post window. I haven’t worked with taxonomies so much. Maybe i’m doing something wrong?

    C W (VYSO)

    (@cyril-washbrook)

    I quickly attempted to create a taxonomy with Custom Post Type UI, and I had no problems with it.

    You say that you “can’t create categories in add post/edit post window”: do you mean that there was no “custom_categories” box in which you could create or select categories? Did you open “Screen Options” (top right-hand corner) in order to check whether the box was there?

    Thread Starter MI

    (@mariukas)

    Oh, I just noticed that i didn’t selected ‘Hierarchical’ as TRUE and that’s why it was not working as I wanted. Thank you very much for the help Cyril!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Separate categories for custom posts’ is closed to new replies.