Posted on

Yoast Local SEO compatibility issues

Yoast Local SEO plugin breaks Relevanssi search. It enhances the search by adding meta queries. Unfortunately they don’t work with Relevanssi. The fix is simple, though. Add this to the theme functions.php:

add_filter( 'relevanssi_modify_wp_query', 'rlv_meta_fix', 99 );
function rlv_meta_fix( $q ) {
	$q->set( 'meta_query', array() );
	return $q;
}

This clears out the meta_query.

This only applies to Yoast Local SEO. This does not apply to regular Yoast SEO.

14 comments Yoast Local SEO compatibility issues

  1. Put this in my functions.php and it still doesn’t work – the results are still blank! Whenever I disable Yoast Local, everything works fine, when I enable it, blank search. Any suggestions? Using Genesis WP Theme

  2. Hi, I did that code, you mentioned below and it prints:

    array(0) {}

    I have themeforest’s Belief Theme, and I can see their template builder has layout settings for the search page (adjusted to “default” template here)

    I disabled ACF and Yoast SEO, still the results come out blank like in this attachment.

    I can see the index is working fine on the settings page, but no results after searching on the front end

    What should I try?

    1. I took the print while trying something to make Relevanssi work, don’t mind the “blog page” header, it reads “Search Results” normally here but no results. if I disable Relevanssi, search results appear normally

  3. Hello Mikko, firstly: I’m very happy with your plugin!
    I have added this piece of code because I’m using Yoast. What I can’t understand: this works perfectly on 1 website (www.timhupkes.com/shop) but not at all on the basic website (www.timhupkes.com). It doesn’t find 1 word..! I have no idea what I could possibly do to improve matters… I’m using the theme Twenty Sixteen.

  4. Mikko,

    Thank you for all your work in this plugin, but unfortunately I can’t seem to make this work on my site. I have one blog post that is over 45,000 words and relevansi can’t seem to find that blog post at all. It can’t find anything relevant to the search terms I type in. I have blog posts with the word RV in the title and it doesn’t display them. I have another blog post called travel excuses and relevansi only displays my about page. I have been all over your knowledgebase center, forum, youtube, google and relevansi settings trying to figure this out today. Can you please help? If I can’t get it to work I am going to have to uninstall it and look for something else. My site is aowanders.com

    1. Adam, the word “RV” cannot be found, because the shortest words Relevanssi indexes by default are three letters long. See the advanced indexing settings, there’s a setting you can use to make Relevanssi index two-letter words.

      But looks like you’ve already moved on to SearchIQ?

  5. I’ve had this issue with only the Yoast plugin installed, and not Yoast Local SEO.

    I tried this fix and it worked, but it caused a fatal error on the front end of the website.

    The fatal error came from a WooCommerce price filter widget as it was trying to combine the meta_query array with another array, but since the meta_query was no longer an array, it produced a fatal error.

    I fixed the problem by updating the code to this:

    add_filter(‘relevanssi_modify_wp_query’, ‘rlv_meta_fix’, 99);
    function rlv_meta_fix($q) {
    $q->set(‘meta_query’, array());
    return $q;
    }

    I’m not sure if this will still fix the issue with Yoast Local SEO, but it worked for me with Yoast SEO and WooCommerce.

Leave a Reply

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.