Posted on

Elementor

Elementor is a popular page builder. It works rather well with Relevanssi.

Elementor page editor searches are broken

Enabling Relevanssi in the WP admin breaks some Elementor editor searches, like the search for templates. This will be fixed in the next version of Relevanssi, meanwhile you can fix the problem by disabling Relevanssi in the admin searches, or by adding this to your theme functions.php:

add_filter( 'relevanssi_search_ok', function( $ok, $query ) {
	if ( 'elementor_library' === $query->query_vars['post_type'] ) {
		$ok = false;
	}
	return $ok;
}, 10, 2 );

Highlight in documents breaks entrance animations

In some cases enabling Relevanssi in-document highlighting breaks pictures with entrance animations. You can add this function to your theme functions.php to fix the problem.

add_filter( 'relevanssi_clean_excerpt', function( $content ) {
    if ( preg_match_all( '/data-settings="(.*?)"[ >]/', $content, $matches ) ) {
        $source  = array();
        $replace = array();
        foreach ( $matches[1] as $match ) {
            $source[]  = $match;
            $replace[] = str_replace( '"', '"', $match );
        }
        $content = str_replace( $source, $replace, $content );
    }
    return $content;
} );

Leave a Reply

Are you a Relevanssi Premium customer looking for support? Please use the Premium support form.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.