Home › Forums › Backend Issues (wp-admin) › Error Ajax list taxonomy
ERROR: http://localhost/mensageria/wp-admin/admin-ajax.php
Hi i have a problem with acf/fields/taxonomy/query/key=field_62d02ad58c59f, because when call a function, my field show ERROR 500 in wp-admin/admin-ajax.php and my terms in list not show.
array(
'key' => 'field_62d02ad58c59f',
'label' => 'Clients',
'name' => 'clients',
'type' => 'taxonomy',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '25',
'class' => '',
'id' => '',
),
'admin_only' => 0,
'taxonomy' => 'cat_notice',
'field_type' => 'select',
'allow_null' => 0,
'add_term' => 0,
'save_terms' => 1,
'load_terms' => 1,
'return_format' => 'object',
'multiple' => 0,
),
add_filter('acf/fields/taxonomy/query/key=field_62d02ad58c59f', 'my_acf_fields_taxonomy_query', 10, 2);
function my_acf_fields_taxonomy_query( $args, $field, $post_id ) {
// Order by most used.
$args['parent'] = 0;
return $args;
}
Its my code is like exemplo in documention, but my field inside other field/repeater.

The issue is that you have added a filter specifying 2 arguments to be passed but your function requires 3 arguments.
// 4th parameter is number of args to pass = 2
add_filter('acf/fields/taxonomy/query/key=field_62d02ad58c59f', 'my_acf_fields_taxonomy_query', 10, 2);
// function requires 3 args
function my_acf_fields_taxonomy_query( $args, $field, $post_id ) {
// Order by most used.
$args['parent'] = 0;
return $args;
}
You must be logged in to reply to this topic.
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.