Hi, I’m trying to add a simple category filter to add to an ACF field. I would need to filter the search results, restricting it to only two specific categories for selection. I use this code in functions.php
thanks
add_filter('acf/fields/taxonomy/query/name={$cat_f}', 'my_acf_fields_taxonomy_query', 10, 3); //
function my_acf_fields_taxonomy_query( $args, $field, $post_id ) {
// Show 2 terms per AJAX call.
$args['name'] = 'cat1, cat2';
return $args;
}
limiting the selection to only two specific terms from the standard taxonomy of WP categories