Global search leaving out WooCommerce products when not logged in
-
Through a good deal of trial/error, on a hunch I disabled Press Permit Core and found that it was causing an issue with our global site search functionality. All WooCommerce products were being left out of search results completely unless you logged in as an admin user.
Inspecting the WP_Query query, these two clauses were being added to the WHERE clause when you’re not logged in as an admin user:
AND ( ( wp_posts.post_type = 'post' AND ( 1=1 AND ( ( wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed') ) ) ) ) )
AND (wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private') OR wp_posts.post_status IN ('publish','wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed','private'))
Unsure why those post_status clauses are being repeated over and over. But we really can’t move forward with this issue. I’ll downgrade to 2.1.46 to see if that fixes it, but I’m leery about moving forward with PPC. We just need a way to restrict a hierarchy of pages to a user role, but I found very few plugins that would allow this.
- The topic ‘Global search leaving out WooCommerce products when not logged in’ is closed to new replies.