0

I'm working on a project where I have to filter every Products:product_cat type of taxonomies on ACF. I need those product post type values which contains these taxonomy on the search field. Sadly ACF only supports acf/get_taxonomies_for_select and not like acf/get_post_types. I started with this code, so now I can show all the Taxonomies, but I can't made any filter to it:

// vars
$simple_value = false;
$choices = apply_filters('acf/get_taxonomies_for_select', $choices, $simple_value);


// create field
do_action('acf/create_field', array(
'type'  =>  'select',
'name'  =>  '',
'class' =>  'select-post_type',
'value' =>  '',
'choices' => $choices,
));
  • Someone made a post type select field for ACF. nl.wordpress.org/plugins/… Mabye its useful. Otherwise you could create the choices yourself with the get_post_types function instead of using a filter – Wilco Dec 20 '17 at 8:27
  • Yes, you are right. Sadly I don't know how to filter it by product_cat taxonomies before array merge – DeluxeD Dec 20 '17 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.