Hi,
After updating XStore/XStore Core today, my site started throwing fatal SQL errors. The issue is caused by XStore generating invalid WP_Query SQL.
I am receiving repeated errors like:
WordPress database error Unknown column 'posts.ID' in 'IN/ALL/ANY'
Example query generated by the theme:
AND posts.ID IN (
SELECT tr.object_id
FROM 59_term_relationships AS tr
WHERE tr.term_taxonomy_id IN (204,289,207,203,217)
)
The problem is that posts is not a valid table alias, and the correct table is: 59_posts
WordPress never uses posts without $wpdb->posts or an alias, so this SQL breaks the entire site.
This only started happening after today’s XStore update, so the issue is coming from the theme or XStore Core plugin adding broken taxonomy filters (brands/categories filtering or custom queries).
Its as though the incorrect posts.ID references needs replacing with the correct value ie: {$wpdb->posts}.ID
or use the alias already defined in your query builder.
This bug affects any WP_Query inside XStore (product archives, Elementor templates, popups, fonts, etc.) and makes the site unusable.
Please confirm and issue a patch as this is not caused by plugins or my database prefix. Other themes do not generate this SQL. Only XStore’s update injected the incorrect posts.ID condition.
Thank you kindly.