Query Builder and Taxonomy

I am using the QB to pick out products for the shop. The shop has a dozen categories or so.

I have recorded a video to show what happens when I create a query into Products and then pick a category.

The dropdown is loaded every single taxonomy term from every CPT in the site, thousands of them. It also seems to include all the pages and posts too.

The SQL possibly caused a server meltdown for me with 100% CPU and two dozen MySQL queries going mad.

The SQL behind that dropdown is this:

SELECT DISTINCT wp_posts.ID FROM wp_posts LEFT JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.ID WHERE 1= 1 AND wp_posts .ID NOT IN (21, 92639) AND wp_posts.post_type IN (‘page’, ‘post’, ‘acf-taxonomy’, ‘acf-post-type’, ‘acf-ui-options-page’, ‘hps-advertiser’, ‘hps-award’ , ‘booklet’, ‘document’, ‘hps-event’, ‘hps-extended-data’, ‘hps-group-content’, ‘group’, ’ hps-member-news ‘, ‘people’, ‘photographs’, ‘plant’, ‘publication’, ‘hps-testimonial’, ‘acf50.603s1-field-group’, ‘product’, ‘shop_order’, ‘aw_workflow’, ‘shop_subscription’, ‘upt_user’, ‘bnfw_notification’, ‘rank_math_schema’, ‘wc_membership_plan’, ‘wc_user_membership’) AND ((wp_posts.post_status <> ‘trash’ AND wp_posts.post_status <> ’ auto-draft’ AND wp_posts.post_ status <> ‘tco- data’)) AND (wp _posts.post_title LIKE ‘%Any m %’ OR wp_posts.post_type LIKE ‘%Any m%’ OR wp postmeta.meta value LIKE ‘%Any m%’) LIMIT 0, 300;

You can see that this is related to my typing “Any m” in the last few lines.

This has been there for the last few releases - the taxonomy query really ought to be picking terms from taxonomies belonging to the post type being queried - the above is massive overkill.

See below - the query should only be for taxonomy terms directly related to Products.

Hey Bill,

Please provide us the following info in a Secure Note so we’ll have an idea of your content.

  • WordPress Login URL
  • Admin username and password
  • Layout name (if you have multipe layouts)

You can find the Secure Note button at the bottom of your posts.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.