Support

Account

Home Forums Backend Issues (wp-admin) Error Ajax list taxonomy

Solved

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;
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.