Skip to main contentSkip to footer

Sometimes you want to get a specific post as the first result for a certain search, but Relevanssi doesn’t return the right post as the first result by itself for some reason. Relevanssi Premium has a tool for these situations: pinning.

Pinning allows you to specify keywords for each post, and whenever that keyword is used in the search, the post will appear as the first result. If multiple posts are pinned for the same keyword, they will appear in their natural order.

It’s also possible to pin a post for all searches it appears in. Whenever the post is included in the search results, it comes first.

How to use pinning

Pinning is done from the post editor. Relevanssi Premium adds Relevanssi controls to all post types that are indexed. In the block editor, the Relevanssi controls are somewhat hidden by default but can be found from the “three dots” menu on the top right:

If you want easier access to the Relevanssi controls, you can add them to the toolbar from the star button:

The pinning settings can be found under “Pinning”. The “Pin this post for all searches it appears in” checkbox pins the post for all keywords; it’s practically equivalent to adding all words in the post to the keyword field.

In the classic editor, the Relevanssi Premium controls are generally always visible, but if they’re not, you can enable them from the “Display options” settings on the post editor page.

Pinning with weights

Relevanssi Premium 2.21.0 introduces a new feature: you can now add weights to pinned phrases. Previously, the order of the pinned posts was based on the natural order of the posts. Now you can control it with weights.

Let’s assume you have two posts you want to pin for the keyword “lentil”. You want one of them to be first, so you give it more weight. You pin that post for “lentil (10)”. The other post you pin for “lentil”, which means the default weight of 1. The post with the weight 10 will always be first when someone searches for “lentil”, and the other post will be second.

What if you have a post that is pinned for “lentil soup”? If someone searches for “lentil soup”, the posts pinned for “lentil” will be on top of that search as well because the words in the search phrase are considered individually: all posts pinned for “lentil soup”, “lentil” or “soup” will be on top of the results.

Relevanssi does prioritize the length of the pinned phrase. Any posts pinned on “lentil soup” will be before posts pinned on “lentil”, no matter what the weights are.

Your account

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

Search

Popular Resources

YITH Badge Management
The Premium version of YITH Badge Management has a search feature for badges. Using Relevanssi breaks that badge search. Fortunately,…
Adding a search form in the navigation menu

…the SearchWP Modal Search Form. As the name says, the plugin is from the SearchWP developer Jon Christopher, but it also works great with Relevanssi. This plugin can easily add a search feature to your navigation menu or a site header. The search form also works great on mobile devices….…header. That’s a good reference if you want to build a nice search form in the header. If your theme does not include a built-in search form and you’re not interested in building one yourself, one of the best plugin options is the SearchWP Modal Search Form. As the name…WordPress doesn’t make adding a search form in the navigation menu easy. It’s a popular request, though, and having access to the search in the site header is typical. Relevanssi itself doesn’t have opinions on the user interface. Some themes, like Twenty Twenty, include a built-in search feature in the…

Related Posts:

Comment Section:

2 Comments. Leave new

  • So WooCommerce products use the “classic editor” still for some reason. The “Screen Options” in a product doesn’t have a Relevanssi option, and I can’t find the Pinning feature anywhere for products. Any help on how to activate the pinning feature on Products for WooCommerce would be RAD! thanks. 🙂

    Reply
    • Josh, the “Relevanssi” metabox should be in the “Screen Options” list, but only if the product post type is enabled in the indexing settings and if the user has high enough capabilities. This used to require “admin” level access; it was changed to “editor” in 2.15.3, but authors still can’t see it. If you want authors to see the metabox, you can use the relevanssi_sidebar_capability filter hook to adjust the minimum capability to publish_posts to allow authors to see it.

      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