Skip to main contentSkip to footer

Here’s how you can disable Relevanssi Light for a particular post type. The example is shop_order from WooCommerce: you’ll need this if you use the legacy order storage. Otherwise, Relevanssi Light will stop the admin order search from working.


add_action('init', function() {
	add_filter( 'posts_search', function( $request, $query ) {
		if ( 'shop_order' === $query->query['post_type'] ) {
			remove_filter( 'posts_search', 'relevanssi_light_posts_search', 10 );
			remove_filter( 'posts_search_orderby', 'relevanssi_light_posts_search_orderby', 10 );
			remove_filter( 'posts_request', 'relevanssi_light_posts_request', 10 );
		}
		return $request;
	}, 1, 2 );
}, 11 );

Your account

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

Search

Popular Resources

Simple French plurals
If you have Relevanssi Premium and want to make Relevanssi understand French plurals, you can add this code to your…
Sorting search results
If you want something else than the default relevancy ranking, you can use orderby and order parameters for the search…

Related Posts:

Comment Section:

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