ACF filter not working in Frontend. Works in ACF though

[ad_1]

Hi, I have defined this ACF filter. This works in ACF backend form, but doesn’t work in Frontend form

While defining the Frontend form, I have tried both including the full set of fields in ACF group, as well as just the individual field in ACF. The form returns all terms in the taxonomy ignoring the filter.

What could be the reason?

add_filter('acf/fields/taxonomy/wp_list_categories/name=item_type_taxonomy', 'custom_taxonomy_filter', 10, 2);
add_filter('acf/fields/taxonomy/query/name=item_type_taxonomy', 'custom_taxonomy_filter', 10, 2);
function custom_taxonomy_filter($args, $field) {
     // Limit the terms to specific term ids in the specified order
     $args['include'] = array(5168,5175);
     return $args;
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer