So I just want to be upfront and say that I know this is caused from a plugin conflicting with the theme. I don’t need any help resolving this issue. I have already fixed it myself.
this is the query that runs when you put “pants” in the woocommerce search widget.
in the snippet below the LEFT JOIN in italics is the one that the theme adds and in bold are the LEFT JOIN that a plugin adds. As you can see there are two instances where the same table is left joined without using an alias.
It doesn’t look like your LEFT JOIN is added by adding a meta_query to the $wp_query, which leads me to believe it is added through filtering the sql or $wp_query->query or something to that effect.
However you are doing it ends up producing situations like this where two joins of the same table can be unaliased.
SELECT SQL_CALC_FOUND_ROWS DISTINCT wp8p_posts.* FROM wp8p_posts LEFT JOIN wp8p_postmeta ON (wp8p_posts.ID = wp8p_postmeta.post_id AND wp8p_postmeta.meta_key = ‘eh_pricing_adjustment_product_visibility_user_role’ ) LEFT JOIN wp8p_postmeta AS mt1 ON ( wp8p_posts.ID = mt1.post_id ) LEFT JOIN wp8p_postmeta ON wp8p_posts.ID = wp8p_postmeta.post_id WHERE 1=1 AND (
wp8p_posts.ID NOT IN (
SELECT object_id
FROM wp8p_term_relationships
WHERE term_taxonomy_id IN (10)
)
) AND (((wp8p_posts.post_title LIKE ‘%pants%’) OR (wp8p_posts.post_excerpt LIKE ‘%pants%’) OR (wp8p_posts.post_content LIKE ‘%pants%’) OR (wp8p_postmeta.meta_key = ‘_cornerstone_data’ AND wp8p_postmeta.meta_value LIKE ‘%pants%’))) AND (
(
wp8p_postmeta.post_id IS NULL
OR
( mt1.meta_key = ‘eh_pricing_adjustment_product_visibility_user_role’ AND mt1.meta_value NOT LIKE ‘%administrator%’ )
)
) AND wp8p_posts.post_type = ‘product’ AND (wp8p_posts.post_status = ‘publish’ OR wp8p_posts.post_status = ‘acf-disabled’ OR wp8p_posts.post_status = ‘private’) GROUP BY wp8p_posts.ID ORDER BY wp8p_posts.menu_order ASC, wp8p_posts.post_title ASC LIMIT 0, 12
I just thought I’d bring this to your attention.