500 error on Terms query with Meta Query

Description:
I have created a CPT called ‘partners’. Within this CPT a custom taxonomy has been created that links a partner to a country. Every country is therefore a term within the taxonomy ‘Countries’. Each term within this custom taxonomy has an ACF field in which the matching continent can be set.

We want to use this data to build a layout that shows an overview of all countries. The filters should make it easier to get to the right country.

Step-by-step reproduction instructions:
I’m attaching some screenshots of my query settings here:

image
Query settings


Meta Query settings


Query code

Errors

Query
https://dbi.companyfuel.dev/wp-json/wp_query/args/?query_args={"taxonomy"%3A["countries"]%2C"search"%3A""%2C"childless"%3Afalse%2C"hide_empty"%3Afalse%2C"count"%3Afalse%2C"pad_counts"%3Afalse%2C"hierarchical"%3Afalse%2C"meta_query"%3A[{"key"%3A"field_6360f73d3aad4"%2C"value"%3A"popular"%2C"title"%3A"Continent"}]%2C"orderby"%3A"date"%2C"order"%3A"DESC"%2C"paged"%3A1%2C"page"%3A1}&query_type=terms&template_dynamics=["taxonomyqueryurl"%2C["acffield"%2C"field_6360e0636675d"%2C"termquery"%2C"false"%2C"false"%2C"cwicly%2Fimage"]%2C["acffield"%2C"field_6360e0636675d"%2C"termquery"%2C"false"%2C"false"%2C"cwicly%2Fimage"]]

Fatal error
Fatal error : Uncaught Error: Call to undefined method WP_Term_Query::have_posts() in /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-content/plugins/cwicly/core/includes/dynamic/api/cc-query-api.php:482 Stack trace: #0 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_Query_Route_To_REST_API->get_items() #1 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request() #2 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch() #3 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/rest-api.php(394): WP_REST_Server->serve_request() #4 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/class-wp-hook.php(307): rest_api_loaded() #5 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #6 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/plugin.php(524): WP_Hook->do_action() #7 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/class-wp.php(398): do_action_ref_array() #8 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/class-wp.php(770): WP->parse_request() #9 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-includes/functions.php(1330): WP->main() #10 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-blog-header.php(16): wp() #11 /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/index.php(17): require(‘/home/deb56708n…’) #12 {main} thrown in /home/deb56708n36/domains/companyfuel.dev/public_html/dbi/wp-content/plugins/cwicly/core/includes/dynamic/api/cc-query-api.php on line 482

Link: https://dbi.companyfuel.dev/

Environment info

  • WordPress version: 6.0.2
  • Cwicly Plugin version: 1.2.5.1
  • Cwicly Theme version: 1.0.3

Hi @GM-Mike,

Sorry for the late reply.

This didn’t make it in 1.2.5.2 but by the log I can see why this is happening.
Thanks for the detailed report!
We’ll issue a fix as soon as possible.

Please bear with us :slight_smile:
Cheers,

1 Like

Hello @GM-Mike,

Apologies for the delay for this fix.
1.2.6 should address it.

If you encounter any specific issues related to this, please let me know by replying to this thread.

Thanks for your patience!

1 Like

Hi @Louis,

First of all thank you for the update!

However, something still seems to go wrong as no results are shown.

My settings are still as shown in the screenshots in my initial help request. My guess is that it has to do with filtering based on of an ACF field associated with the term.

Is this already supported or does this require an adjustment to the plugin, as has already been implemented for ACF fields that are linked to an options page.

If you want to investigate this further within my environment, I will be happy to provide you with login details.