DB Error caused by using multiple attribute filters after upgrading to 4.5.1
-
After upgrading to 4.5.1, using attribute filters can cause db error.
Steps:
1. Add multiple attribute filters with ‘OR’ condition to shop sidebar
2. Navigate to the pages with specific product category, ex: https://example.com/product-category/category1
3. Click one of tax term to filter
4. DB Error occursSELECT COUNT(DISTINCT(product_id)) AS term_count, term_count_id FROM ( SELECT IF(wp_posts.post_type='product_variation', wp_posts.post_parent, wp_posts.ID) AS product_id, terms.term_id AS term_count_id FROM wp_posts INNER JOIN wp_term_relationships AS tr ON wp_posts.ID = tr.object_id INNER JOIN wp_term_taxonomy AS term_taxonomy USING( term_taxonomy_id ) INNER JOIN wp_terms AS terms USING( term_id ) LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) WHERE wp_posts.post_status = 'publish' AND ( wp_term_relationships.term_taxonomy_id IN (24) AND wp_posts.ID NOT IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (7,9) ) AND tt1.term_taxonomy_id IN (98) ) AND ( ( wp_posts.post_type = 'product' AND ( wp_posts.ID NOT IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (4) ) ) ) OR (wp_posts.post_type = 'product_variation' AND NOT EXISTS ( SELECT ID FROM wp_posts AS parent WHERE parent.ID = wp_posts.post_parent AND parent.post_status NOT IN ('publish') )) ) AND terms.term_id IN (31,32,33,34,35) UNION ALL SELECT wp_posts.ID AS product_id, wp_term_relationships.term_taxonomy_id as term_count_id FROM wp_posts JOIN wp_posts variations ON variations.post_parent = wp_posts.ID LEFT JOIN wp_postmeta ON variations.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = 'attribute_pa_color' JOIN wp_term_relationships ON wp_term_relationships.object_id = wp_posts.ID WHERE ( wp_postmeta.meta_key IS NULL OR wp_postmeta.meta_value = '') AND wp_posts.post_type = 'product' AND wp_posts.post_status = 'publish' AND variations.post_status = 'publish' AND variations.post_type = 'product_variation' AND wp_term_relationships.term_taxonomy_id in (31,32,33,34,35) AND ( wp_term_relationships.term_taxonomy_id IN (24) AND wp_posts.ID NOT IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (7,9) ) AND tt1.term_taxonomy_id IN (98) ) ) AS x GROUP BY term_count_id
Error message
Unknown column 'tt1.term_taxonomy_id' in 'where clause'
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘DB Error caused by using multiple attribute filters after upgrading to 4.5.1’ is closed to new replies.