Support

Account

Home Forums General Issues Query custom taxonomy

Helping

Query custom taxonomy

  • Hello, i’m new in wp,also acf.
    I created a custom taxonomy named “shows” and i added a field “genre (action,drama)” and now i’m blocked to show terms who have field “action” or “drama”.

    Sorry for my eng.

  • Hi @bystefu

    I’m afraid there’s no easy way to do this. ACF saves the custom fields values for the terms in wp_options table in this format: custom-taxonomy-slug_99_custom-field-name, where “custom-taxonomy-slug” is the slug of your custom taxonomy, “99” is the id of the terms and “custom-field-name” is the name of your custom field.

    For this kind of situation, you need to use the wpdb class to query them and get the term IDs. After that, you can get the terms by using the get_terms() function.

    I hope this makes sense. Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Query custom taxonomy’ is closed to new replies.