Posted on

Infinite Scroll from Jetpack

Jetpack has Infinite Scroll, which is a pretty cool feature, but unfortunately doesn’t work with Relevanssi on search results pages. Infinite Scroll uses WP_Query to get more posts, and that isn’t compatible with Relevanssi.

I’m not aware of a solution that would allow Infinite Scroll to work with Relevanssi. There isn’t enough room for customization in Infinite Scroll, unfortunately. If you want to use Infinite Scroll on a site with Relevanssi, you need to disable it on search pages.

Here’s how you can disable Infinite Scroll on search pages:

function rlv_disable_infinite_scroll() {
	if ( is_search() ) return false;
	return current_theme_supports( 'infinite-scroll' );
}
 
add_filter( 'infinite_scroll_archive_supported', 'rlv_disable_infinite_scroll' );