Support

Account

Home Forums General Issues acf/fields/taxonomy/query 'Loading Failed' Error

Solved

acf/fields/taxonomy/query 'Loading Failed' Error

  • Hi Everyone!

    This may be a “well-duh” issue for many people, but since it stumped me for a ridiculously long time, I thought I would share. Especially since the current documentation is pretty brief.

    I kept running into a ‘Loading Failed’ error whenever I tried to utilize this bit of code from the taxonomy query:

    <?php
    
    function my_taxonomy_query( $args, $field, $post_id ) {
        
        // modify args
        $args['orderby'] = 'count';
        $args['order'] = 'ASC';
        
        
        // return
        return $args;
        
    }
    
    add_filter('acf/fields/taxonomy/query', 'my_taxonomy_query', 10, 3);
    
    ?>

    I couldn’t figure out what I had done wrong. I had an epiphany this morning that if I was trying to alter the query for the taxonomy term, the loop would need more information than just the Term ID. Once I changed my settings from Return: Term ID to Return: Term Object, everything works fine.

    Just thought I would share this tidbit for any other beginning devs who might be smashing their head against a wall!

    I imagine this works the same way for the Post Object query too.

    PS> Thanks so much for Advanced Custom Fields! It makes life so much better (when you figure out what you’re doing of course).

  • Hi @jessboctor

    I’m afraid that I couldn’t reproduce this issue on my end. Could you please check the developer tools on Google Chrome for the returned request? I’ve attached a screenshot for your reference.

    Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘acf/fields/taxonomy/query 'Loading Failed' Error’ is closed to new replies.