Skip to main contentSkip to footer

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 SEO settings (“Allow search engines to show this Post in search results?”). If the “noindex” setting is in the default value or set to explicit “yes”, Relevanssi indexes the post.

If you want Relevanssi to disregard the Yoast SEO “noindex” setting, you can adjust that from the advanced indexing settings.

Using Yoast SEO title instead of post title

Adding this function to your site will make Relevanssi use the Yoast SEO title instead of post title when indexing posts:

add_filter( 'relevanssi_post_title_before_tokenize', 'rlv_use_yoast_title', 10, 2 );
function rlv_use_yoast_title( $title, $post ) {
    return get_post_meta( $post->ID, '_yoast_wpseo_title', true );
}

(Read more about relevanssi_post_title_before_tokenize.)

Your account

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

Search

Popular Resources

Category title in the search results page

If you’re using category restriction dropdown on your search form, here’s a bit of code that you can add to your search results template to show how many hits were found and what the category is. If no category was selected, this’ll just show how many hits were found. <?php……the category is. If no category was selected, this’ll just show how many hits were found. <?php $cat = get_cat_name( $wp_query->query_vars[‘cat’] ); $s = $wp_query->query_vars[‘s’]; echo $wp_query->found_posts . ” results found with ‘ $s'”; if ( ! empty( $cat ) ) { echo ” in the ‘$cat’ category“; } ?>…

WPML: Category exclusions
Relevanssi category exclusion setting doesn’t work properly with WPML. Here’s a bit of code from Srdjan Jocić from OnTheGoSystems that…
Proximity sorting

Relevanssi Premium 2.16 added proximity sorting to search results. That means you can sort the search results by geographic location. Instead of having the most relevant matches first, you can have the nearest results first. There are many ways to use geolocation in WordPress. The way Relevanssi does this is…

Related Posts:

Comment Section:

6 Comments. Leave new

  • Any chance you can do a similar filter hook to use the meta-title for SEO framework?

    Reply
    • The SEO Framework meta title is stored in _genesis_title, so the function would be:

      add_filter( 'relevanssi_post_title_before_tokenize', 'rlv_use_tsf_title', 10, 2 );
      function rlv_use_tsf_title( $title, $post ) {
          return get_post_meta( $post->ID, '_genesis_title', true );
      }
      Reply
  • That works! (Dashboard > Admin search) How do I tell my search bar to perform this way? I’m very much a novice in this area.

    Reply
  • I added Relevanssi because my default search engine would only search posts (not articles or pages). Relevanssi does the same thing – my results are only from posts; no pages or articles. How do I tell it to search the whole site? Yes, I did check the boxes for these three items when I created the index.

    Reply
    • Relevanssi would search the whole site. If you use the Admin search (Dashboard > Admin search), does that return all kinds of posts? It’s possible your theme is restricting the search results to posts. Does your theme have any settings that could affect this?

      Reply

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