Can't assign taxonomy to custom post type

Support MB Custom Post Type Can't assign taxonomy to custom post typeResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36912
    ArnoArno
    Participant

    Hi,

    I created a custom post type. On the Taxonomies tab of the post type, I selected 4 taxonomies and saved the post type. Nothing happened, the taxonomies didn't get listed under the post type menu.

    Then I went to the Post Types tab of one of the taxonomies, and I selected the post type. This worked fine. However, still nothing is selected on the Taxonomies tab of the post type.

    So in short: I can only assign taxonomies to post types when I edit the taxonomy, not when I edit the post type.

    I have the latest versions of the plugins.

    #36913
    ArnoArno
    Participant

    I now found that the taxonomies were missing when editing a post, after doing the above. I then selected the taxonomies on the Taxonomies tab of the post type. And now they became available.

    Is this by design? I thought it didn't matter where you assigned the taxonomies to a post type. But one method seems to have an effect only on the edit mode of the post, and the other only on the taxonomy menu's available under the post type.

    #36918
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You still need to assign the post type for the taxonomy in Meta Box > Taxonomies > Edit a taxonomy > Post Type tab.

    It is the default behavior of WordPress because the taxonomy is registered later than the post type and the object type (post type) is required to register the taxonomy. Please read more on the documentation
    https://developer.wordpress.org/reference/functions/register_post_type/#taxonomies-2
    https://developer.wordpress.org/reference/functions/register_taxonomy/

    #36930
    ArnoArno
    Participant

    Hi Long,

    Thank you! Good to know this is by design.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.