Home › Forums › Bug Reports › add_filter('acf/fields/taxonomy/query') bug › Reply To: add_filter('acf/fields/taxonomy/query') bug
Your question got me to digging through the ACF code and testing.
Honestly, I can find this line in the acf code
add_action('wp_ajax_acf/fields/taxonomy/query', array($this, 'ajax_query'));
but I don’t see that this line is ever run. This makes me believe that something has changed since that documentation was written, that there is a bug, or that I’m missing something important.
The filters that are applied are when showing checkboxes are these lines in /fields/taxonomy.php line 691
// filter for 3rd party customization
$args = apply_filters('acf/fields/taxonomy/wp_list_categories', $args, $field);
$args = apply_filters('acf/fields/taxonomy/wp_list_categories/name=' . $field['_name'], $args, $field);
$args = apply_filters('acf/fields/taxonomy/wp_list_categories/key=' . $field['key'], $args, $field);
So I tried this and it worked.
function my_taxonomy_query( $args, $field) {
// modify args
//echo 'here'; die;
$args['orderby'] = 'count';
$args['order'] = 'ASC';
// return
return $args;
}
add_filter('acf/fields/taxonomy/wp_list_categories', 'my_taxonomy_query', 10, 2);
I’m going to mark this thread for the developer’s attention and maybe he’ll comment and let us know what’s going on.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.