Skip to main contentSkip to footer

Updating WooCommerce to version 4.4 breaks Relevanssi searches. After updating WooCommerce to version 4.4, Relevanssi searches no longer find results.

This problem is caused by changes in WooCommerce. Those who are interested in the details can go read the GitHub issue I created. For those interested in solving the problem, the next version of Relevanssi will include a fix and meanwhile, you can fix the problem by adding this to your site:

add_action( 'woocommerce_before_shop_loop', 'relevanssi_wc_reset_loop' );
function relevanssi_wc_reset_loop() {
	global $wp_query;
	if ( $wp_query->is_search ) {
		wc_reset_loop();
	}
}

This little function fixes the problem in most cases (please let me know if you have a case where this does not solve the problem!).

Update 21.8.2020: This page originally offered a one-liner solution. The smaller solution works but may have side effects. The new version targets only search queries.

Update 26.8.2020: This fix is no longer necessary with Relevanssi Premium 2.10.1 and Relevanssi free 4.8.1.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Yoast SEO
Starting from versions 2.4.0 (Premium) and 4.3.0 (Free), Relevanssi doesn’t index posts that have been marked “noindex” in the Yoast…
Visual Composer: Indexing headings

Relevanssi doesn’t by default index the headings in Visual Composer. The vcex_heading shortcode Visual Composer for the headings stores the heading text inside a shortcode attribute. By default, Relevanssi does not index shortcode attributes. In this case, indexing the shortcode attribute is necessary. Fortunately, it’s easy to fix with a…

Problems with highlighting in post content

Versions 2.27.5 (Premium) and 4.24.4 (free) added extra security to highlighting search terms in post content. Before that, an attacker with contributor access could inject malicious content in the posts and the highlighting would then trigger that. This is now fixed, but the fix comes with a cost: the post……efficient in-page search feature that can be used to find the matching content. Another option is to adjust the wp_kses_post() functionality with the wp_kses_allowed_html filter hook. If you need to allow CSS styles, for example, you can use this snippet: add_filter( ‘wp_kses_allowed_html’, function( $html, $context ) { if ( ‘post’…

Related Posts:

Comment Section:

7 Comments. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed