why pre_get_posts works fine in post type archive, but not in search result list?
If searching via WordPress ?s=keyword (not WooComm’s Product Search), post_type isn’t set or used, so the following would return false: if( isset($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] == ‘product’ ) { You can explore what $query->query_vars contains on your Products page vs your Products Search page by just printing it and killing the page: function my_pre_get_posts( $query ) … Read more