Skip to main contentSkip to footer

Relevanssi adds a shortcode to help making links to search results. That way users can easily find more information about a given subject from your blog. The syntax is simple:

This will make the text John Doe a link to search results for John Doe. In case you want to link to some other search term than the anchor text (necessary in languages like Finnish), you can use:

Now the search will be for John Doe, but the anchor says Mr. John Doe.

One more parameter: setting  will wrap the search term in quotation marks, making it a phrase. This can be useful in some cases.

Your account

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

Search

Popular Resources

Problems with highlighting in post content

Versions 2.27.5 (Premium) and 4.24.4 (free) added extra security to highlighting search terms in post content. Before that, an attacker with contributor access could inject malicious content in the posts and the highlighting would then trigger that. This is now fixed, but the fix comes with a cost: the post……efficient in-page search feature that can be used to find the matching content. Another option is to adjust the wp_kses_post() functionality with the wp_kses_allowed_html filter hook. If you need to allow CSS styles, for example, you can use this snippet: add_filter( ‘wp_kses_allowed_html’, function( $html, $context ) { if ( ‘post’…

Moving the admin search page

Jules Colle came up with a method of moving the Relevanssi admin search page from under the Dashboard heading to the top level of the admin menu. add_action( ‘admin_menu’, function () { remove_submenu_page( ‘index.php’, ‘relevanssi_admin_search’ ); add_menu_page( ‘Search all content’, ‘Search all content’, ‘manage_options’, ‘relevanssi_admin_search’, ‘relevanssi_admin_search_page’, ‘dashicons-search‘, 2 ); },……introduced. This filter hook lets you add new admin page hooks where Relevanssi javascript is used, so we can introduce our new admin search page: add_filter( ‘relevanssi_acceptable_hooks’, function( $hooks ) { $hooks[] = ‘toplevel_page_relevanssi_admin_search’; return $hooks; } ); Now we have a nice, functioning admin search that is not hidden:……99 ); This function adds an admin_menu action that first uses remove_submenu_page() to remove the existing admin search function and then add_menu_page() to add it again on the top menu level. This works well except for one thing. The Relevanssi admin javascript is added only to specific pages, and the…

Related Posts:

Comment Section:

2 Comments. Leave new

  • There’s no automatic way to do it. Check the Relevanssi source code to see how the “User searches” page is made, you can see the MySQL code to get the most popular search terms.

    Reply
  • Is there a way to show search terms like the shortcode does but in the template?
    I want to display the 2 most popular search terms and while I cant find a way to do this automatically, if I can just show two terms in my template file that would work.

    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