Support

Account

Home Forums General Issues get_fields stops working when taxonomy term used in custom post type Reply To: get_fields stops working when taxonomy term used in custom post type

  • Can you explain more what you mean by this statement?

    “7) I then added a ‘course_categories’ selection to the ‘courses’ I had created.”

    What do you mean by ‘selection’? Radio buttons? A Select drop-down?

    Just off the top of my head, if you are adding a taxonomy to your custom post type, you don’t need to add an additional ACF selection field, especially with the same slug/name. This will create unexpected results.

    Once you’ve created the custom taxonomy, you can use the built-in WordPress support for taxonomies.

    In any case, you have two options so pick one but you shouldn’t really use both:

    1) If you want to use your custom taxonomy, make sure your cpt supports the custom taxonomy and vice-versa that your custom taxonomy is attached to your custom post type.

    Then, make sure your edit screen for your custom post type has your taxonomy box checked in ‘Screen Options’. It should look just like the category box for regular Posts.

    Select your taxonomies for your custom post type posts using that box (no ACF select field necessary).

    — OR —

    2) Use an ACF select field (either Select or Checkbox) and then you can query posts by that field (scroll down to Examples): https://www.advancedcustomfields.com/resources/query-posts-custom-fields/

    Thus, you should either use your custom taxonomy or an ACF field but not both – you are just re-selecting something that is already there.

    All that said, there could be uses for grabbing your taxonomies in ACF but make sure that your ACF fields do not have the same slugs as your custom taxonomy.