Posted on

Most important Relevanssi debugging trick

When you have problems with Relevanssi, these are the first steps to take:

  1. Make sure you have the latest version of Relevanssi. If not, upgrade.
  2. Try deactivating the plugin and reactivating it.
  3. Are you using Yoast Local SEO? Read this.
  4. Try deleting the plugin and reinstalling it from scratch.

If that doesn’t help, then approximately 90% of the time the problem is the same: there’s a query_posts() call on the search results page.

Any calls to query_posts() on search results template make Relevanssi fail silently. You’re not getting results from Relevanssi any more. This is unpleasant, but something I can’t really fix, considering that WordPress doesn’t offer any official way to replace search results and the way Relevanssi is coupled with WordPress is something of a hack. So, something simple like this can throw Relevanssi off.

If you’re having problems with Relevanssi, the first step is to check your search results page, usually search.php. See if there’s a call to query_posts() and if there is, comment it out. In most cases that is enough to fix the problem.

It’s not always query_posts(). Appearance of new WP_Query() is another sign of trouble, or $wp_query->get_posts();. Anything that queries the database for new posts is trouble for Relevanssi.

If you need help, you can post on the Relevanssi support forum. Please include the contents of your search results template, put it in a pastebin and share the link.

  • hi
    using relevansi the results are really crapy
    no header
    no ordering
    no listing…
    any idea?

  • So, did you check if there’s a query_posts call on your search results page?

    • web

      Hi, same issue, can you give me the code I’ll need to place on my search page template? Thanks!

  • rvencu

    Hi, I got into some problems with the Twenty Eleven theme, when I activate Relevanssi I cannot read much in the search result page. In fact it crashes in a strange way.

    There is no such call to query_posts, of course. More tips for troubleshooting would be welcome…

    • rvencu

      My mistake. I was messing up with searchblogs in a wrong way (empty value). Maybe is a good idea to sanitize this value if empty…

  • Mikko, I notice you’ve been furiously updating Relevanssi Premium. Still, if I put admin in the exclusion box, admin searches are all that’s logged. With nothing in the box, it logs all searchers, including of course admin.

    • Oh, sorry. I’ve forgot about that… I’ll add it to my new bug tracking list right away, and I’ll be sure to check it out the next time I’m working at the plugin.

  • Hi Mikko– you’re working hard on updates. Here’s the status of my problem: I login as wpadmin. If I exclude that (or even wp) from the search, it logs my searches, yet no other users’.

    I excluded only “juju” and it logged both my searches and others’. So exclusion works with non-administrative entries.

    I hope this can be solved. Thanks, Philip

  • You need to use user id, not user name. Looks like a documentation problem…

    • Hi Mikko– I have tried all combinations of user id and password…using id first as name and then as password. No combination works. I don’t think I have registered before, so I clicked register. That always brought me back to this page…no place to register.

      And search exclusion of administrator doesn’t work…even with your latest update.

      Help! Philip

  • Have you tried using numeric user id in the log exclusion?

  • Yes. I excluded my user id and it logged both admin and all other searches. I even tried excluding just the numeric part of my id with the same results.

  • Mikko– I’m getting an update to Premium Relevanssi almost every other day. Are you really making all these changes?

    • There are no updates, it’s just the buggy update API that says so. No need to update, unless the version number changes.

  • henk

    Fuzzy matching not working. I only want to search ‘whole’ words. Why is it so difficult to find a plugin or hack to do that? I don’t want anything else, only whole words.

    • Disable fuzzy matching, and Relevanssi will match only whole words. It’s simple as that. If you use highlighting, that may be a bit deceptive, as the highlighting will highlight partial words – that’s not what Relevanssi matches, it’s just the highlighting.

  • Glenn Crocker

    I’m using a MySiteMyWay theme and they have a whole framework it’s built on so finding the query_posts() call is really hard (it’s in lib/functions/theme.php, line 1449 for me, but I don’t want to make framework changes). So I added a wp_reset_query(); call in search.php. It now looks like:

    No idea whether this is going to cause cancer or have other side-effects, but it worked out well for me!

  • Bob Matsuoka

    For some reason, searches stopped returning results. It had been working fine, now nothing. Even rebuilding the index doesn’t work. No query_posts(). Any suggestions for debugging? The log shows lots of successful searches in the past, but now nothing.

  • Bob Matsuoka

    PS — The index appears to be good:

    State of the Index

    Documents in the index: 2049
    Terms in the index: 89133
    Highest post ID indexed: 13352

    Just nothing on search results page.

  • rvencu

    I get the same issue as Bob. Lately I updated WP to 3.4.1 and twenty ten to 1.4 (I am using a child theme of twenty ten).

    • I think we solved Bob’s problem, but I don’t remember how… I’ll have to see if I can find out how.

      • I’d love to hear how Bob’s issue gets resolved as well, since I’m seeing the same thing. It used to work a few weeks ago, yet now it doesn’t provide any results.

        If I disable the plugin and search the same terms, it provides tons of results.
        Re-enabling and re-indexing doesn’t change the no results issue.

        I also made sure there was no query_posts in the search.php document.

        • Which version are you running, David?

          • Dave Stone

            I’m running Relevanssi 3.0.3 for the fist time on WP 3.3.2 and I’m getting the “No posts yet !” message. Index built successfully.

            I’ve commented out the query_posts in my search.php.
            I’ve deactivated and reactivated several times.

            Still no search results. Do you remember how you helped Bob?

          • I think the problem might still be in your search results template somehow.

  • owcv

    I have an issue with the title boost and no query_posts() call on my page. The titles of my posts, pages and custom post types doesn’t seem to get the needed relevance, even if I have set the boost to 5 in the Relevanssi-backend. I want the search results that way, that if the title matches, the post/page is on top of the results. How to do that?

    • Well, for starters, 5 is not much – set the boost to 50 or 100 and see if that helps.

  • jon

    Hi – I’m using WordPress 3.4.1 and Relevanessi Version 3.0.1. I think I’ve used the plugin for over a year or two with no problems. Now, some time reasonably recently (last few weeks?) it’s stopped working (just get a “no results” message when searching). I’ve double-checked for the presence of query_posts() but it’s not there. I notice a couple of other people here have what might be the same problem.

    • It was probably the update. Try to deactivate and reactivate the plugin to see if that helps.

  • jon

    Ah – that seems to have done it (also re-built the index too – don’t know if that helped). Thanks.

  • Hi, ever since the 3.0.2 upgrade my search results have odd code at the end. It’s probably because I’m also using the GD Star Rating plugin. But the previous version of Relevanssi didn’t do this. Here’s a sample:

    This is Victoria just west of Beacon Hill Park from 1954. You can still make out the Empress Hotel and the Parliament Buildings off in the distance. UA:F [1.9.20_1166]please wait…Rating: 0.0/5 (0 votes cast)…

    • Yeah, probably something with GD Star Rating. Don’t know what, though…

  • Okiante

    Can you please let me know what needs to be done to make the plugin working with optimizepress? It is not showing any search results after indexing pages

    Thanks much,

    • No idea, I’m not familiar with the theme. Did you read this post, about the query_posts() stuff? That’s your best bet.

      • Okiante

        Hi Mikko,
        Yes, just after submitting the comment I could make it work. Thanks so much 🙂

  • Toni

    Hi Mikko,

    I really like your plugin. There is one thing I can’t seem to fix:
    I want to show custom excerpts of “pages” including a custom read more link.


    For enabling page excerpts I used:

    For enabling custom read more links I used:

    code used:
    function new_excerpt_more($more) {
    global $post;
    return ‘ID) . ‘”>Read the Rest…‘;
    add_filter(‘excerpt_more’, ‘new_excerpt_more’);

    In the plugin:
    – Create custom search result snippets: enabled
    – Allowable tags in excerpts: -blanc-

    Somehow I’m not seeing it and I’ve maxed out my daily coffee intake so if you are able to help me fix it or point me in the right direction that would be awesome.

    oh and no query post shizzle going on.


    • Yeah, looks like the excerpt_more filter doesn’t work. Here’s a workaround I found in Twenty Ten:

      function custom_excerpt_more( $output ) {
      	if ( has_excerpt() && ! is_attachment() ) {
      		$output .= " > Read the test";
      	return $output;
      add_filter( 'get_the_excerpt', 'custom_excerpt_more' );
  • Toni

    The test is read.

    First part works!
    Thanks for the quick reply
    Up to styling now.

    One point:
    It still displays the first few lines of the page instead of the custom excerpt.
    How do I hook into my custom Excerpt? Or is the above code for enabling excerpts on pages not accurate anymore?


  • If your theme is using the_excerpt() on search results pages, Relevanssi should take over the excerpt, and it doesn’t matter if you have the excerpts enabled for pages or not.

  • Dave Stone

    Are there any other functions besides query_posts() that may be preventing Relevanssi results from appearing?

  • Bill


    It appears for us (using HTML5 Reset Framework), we are seeing the index build, but we are not getting results for custom content types (using Custom Content Type Manager) and custom fields (specifically relation type fields).

    Some of the content is found in the index table but does not show as a result. We should note that the terms are being picked up and indexed for the entire custom post type, just not found as a result.

    Is there a way we can extend the indexing or results to show this?


    • Bill, if you’re a registered user, please use the support form to send me more details. Which version are you using? What are those content types? Are they post types, or something else?

  • Hi Mikko,

    I love Relevanssi and thank you for all the hard work. I’ve got a problem that I’ve just noticed recently, one that persists even if I turn off Relevanssi, but I’m still hoping you might be able to help me zero in on the fix:

    Some search results to pages and posts are suddenly missing links to the source. For example, look at this page:

    Notice the first two results don’t have links, but the third that includes the h2 title does and the next one with the h2 title and featured image does.

    Any idea as to why this is happening?

    Yes, I have checked my “search.php” for query_post call and I’m clean. Any and all insight you can provide would be greatly appreciated.



    • Tim, problem is in your style sheet. All those results have h2 titles, but your style sheet sets .page-title to “display: none”, which means they don’t show up. The post meta and bylines appear on those two results, because those two are posts and the other are pages. The answer to that problem lies in your search results template.

      • Mikko,

        You are a superstar. How did you find that? Now I will try and fix it…

        Thank you so much!


        • Took a look at your site using the “Inspect element” feature of Google Chrome. It’s the best tool for a web designer. For Firefox, you can use Firebug, and other browsers have similar features.

          • Fixed!!! I changed the CSS to to display none… and now the h2’s appear in the search.

            Yes, I use the equivalent tool in Safari, but I overlooked what you clearly saw.

            Thank you again so very much, Mikko!



  • Zack

    Results don’t change. No query_post call in search.php. Any suggestions?
    Searches are being logged.

  • Hi Mikko – I installed your plug-in and then get no results. There does not appear to be a query_post() call in the search php. I must be doing something wrong but I cannot figure it out. Your plug-in is disabled on the site right now. Thanks for any help you can give.

    • Which version you have? Is the “Limit searches” option enabled, but the “Limit” option empty?

      • The latest version and I had limit searches enabled and the limit set to 500. Let me try it without that limit.

  • Here’s what I have – any help would be forever appreciated!

    News Topics

    <div >
    <h3 id="post-“><a href="” rel=”bookmark” title=”Permanent Link to “>

    <?php the_tags('Tags: ', ', ', '’); ?>
    Posted in


    No posts found. Try a different search?

    • Kurt, send me the search template to mikko @ or post it to a pastebin somewhere, as the comment system mangles the code.

  • Ken

    Hi there. I’d like to first say, great plugin! It’s made our search a lot more useful, and is very simple to use.

    I am having one problem-whenever the search string is wrapped in quotes (e.g., “foo bar”) the page dies, but wordpress doesn’t throw any fatal errors. I am using query_posts() (but in the sidebar, not the search result section), but commenting them out didn’t help.

    Any ideas?

    • Ken, like my previous comment says – send me the code to mikko @ or post it to a pastebin, so I can take a look at it.

  • Gio

    Hello, I installed this plug-in and set the right settings. But I’m stuck now. How do I add the searchoption so this is visible on a page or in the widgetarea? my site is in dutch

    If it works good im getting the premium version.

    • Just use the default WordPress search widget, Gio.

  • So this may be a dumb question, but I’ve installed the plugin. Is there a RelevanSSI Search widget or something like that that I can use in the sidebar? Thanks!

    • Just use the default WordPress search widget, Ben.

  • New WEB site soon to be launched. I must say that this is by far the best search engine for sites that I have ever seen. But, I have a small problem. Our site is all about “Wi-Fi” so people will search for this term. Problem is that relevanssi interpret this as a Boolean NOT searching for all pages containing Wi but not Fi, no pages will be found in searches…….
    I there any way to:

    A. Have a “include” word saying boolean NOT should not be used for th term Wi-Fi.


    B. Disable the boolean NOT feature

    A bonus question:

    People may use wifi, WiFi, Wi-Fi when searching, but my site use Wi-Fi, is there any way to define alternative words that should be tied to the indexed Wi-Fi term? So searching for wifi will include results containg Wi-Fi?

    Thanks in advance!

    • First of all, if you’re running the free version of Relevanssi (I assume so, as you’re not using the customer support form to contact me), there simply isn’t a boolean NOT operator in Relevanssi.

      What you’re seeing is punctuation removal, which replaces the dash with a space, resulting in “wi fi”, which is then not searched, as the minimum word length for indexing is 3 by default.

      Relevanssi is case insensitive, so that doesn’t matter. There’s the synonym feature which you can use to support alternative spellings, but what I suggest here is a simple function:

      add_filter(‘relevanssi_remove_punctuation’, ‘fix_wifi’, 9);
      function fix_wifi($str) {
      $str = str_replace(‘wi-fi’, ‘wifi’, strtolower($str));
      return $str;

      After you add this to functions.php of your theme, reindex. Now every occasion of wi-fi, in posts and search queries, will be normalized to wifi. Problem solved.

      • Thank you Mikko!

        • Hey Mikko,

          i’ve a similiar Problem and could not get any result while looking for “R.O.O.M”, what is a post_title.

          I tried setting ‘relevanssi_min_word_length’ to 1, but it doesn’t work.
          Then I tried to use your synomys feature and defined ‘room = R.O.O.M.’, ‘ROOM = R.O.O.M.’ and it also returned zero results.

          My last try was using your “fix_wifi” filter function from the comment above. I modified it to str_replace(‘r.o.o.m.’, ‘room’, strtolower($str)) but at all nothing worked.

          I hope you could point me into the right drection.

          Regards Carsten

  • We have a strange problem with Relevanssi. We made the index without problems, but on the site we have no results, but we can see hits in the Relevanssi User Searches. The admin searches works fine,, but no results on the side.
    So far as well. We have a Developer Environment, where we use exactly the same Software and there it works fine. We make a svn checkout on our productivity server, so it is exactly the same software, but it does not work outside.
    I changed the theme outside but i got no results. I interchange the DB, but it only work in the developer Environment.
    So we supposed that it is a spooky php fenomen. But there is nothing in the error.log
    Perhaps you have any suggestion?

    • Dirk, last time someone had a problem like this, it was caused by a subtle difference in either Apache or PHP configuration between the development and production environments.

      • Thank you Mikko, you got a hint what it could be. I compared the and did not find anything suspect.

        • Last time the problem was caused by PCRE settings, I found the post in my archives.

          • Dirk Müller

            OK, I Found the source of defect. It was a different Theme of WPTouch Pro, which is a Plugin for Mobile Devices. I could not imagine that this has influence also to the Webtheme, but it could.

          • SN0WKRASH

            We are having the same problem with Relevanssi not working with WPTouch Pro – not showing results
            using any theme that came with it – how did you solve this problem?

          • Dirk Müller

            The Classic-Theme work for us and I could make a Childtheme from that as well. Do you make any Searchmanipulation in the root-functions.php?

          • SN0WKRASH

            we made no modifications to search and none to the themes and none to the plugin code. What weird is that it shows that there are a number of results, but the actual page says no results found, directly below where it says the search returned x number of results. So I’ll do a search and get a page where at the top it says I have 29 results in the header area, and below that the search results page itself says there were no items in my search. you can see this at http://www.ablogtowatch(dot)com on the smartphone

          • Dirk Müller

            This is not the same Problem I had. My Search did not work for both: Mobile and Desktop. I had made Category Exclusion for the Search in the Mobiletheme and for that relevansi did not work. But I was surprised that the Mobiletheme from WPTouch Pro effect also my Desktoptheme (Thematic).

            Your Desktop search works. So I think you have to modify the root-funktons.php to add the search result. Does your Mobile search work without relevansi?

          • SN0WKRASH

            mobile search does work without relevanssi – I think I have to find another solution because we need mobile to work

          • Probably 3 years too late, but the reason is that search.php in the WPtouch theme uses a custom query. Instead you can use the code from index.php as a base which just loops through the default query.

  • Im having a similar issue. It worked when i downloaded and tested it but just recently i see no results on the search page, only hits in the user search logs. I tried everything above, and an upgrade of the plugin but still no results show.

    • Hard to say what’s wrong. Which version did you download, and to which version did you upgrade?

      • I can exactly remember the original version, i think 3.0.1 i have since upgraed to Version 3.1.3. Both versions were not displaying results. wordpress version 3.4 I understand you can only guess at this point, so any pointers or PHP settings you know of would be great, thanks!

        • I’d start by looking at a var_dump($wp_query); on the search results page to see if there’s anything unusual there, then I would drop var_dump() calls in Relevanssi search functions (relevanssi_search() in lib/search.php) to see where in the process the results go missing.

          Actually, start in relevanssi_query() (also in lib/search.php) – does it return the search results in $posts variable or not?

          • when i ran var_dump($wp_query); on the search results page it returned nothing, but when i do var_dump($wp_query); inside the relevanssi_query() function it returns matching results in an the array. so it is finding the results just not displaying theme, could be a theme issue i guess based on that.

          • Some online shop site I fixed – I’m not sure if it was WP-eCommerce or some other plugin – had a search form that by default excluded products from the search.

            Add this to your search results page: global $wp_query; var_dump($wp_query->query_vars[‘post_type’]);

          • global $wp_query; var_dump($wp_query->query_vars[‘post_type’]);

            returned blank… im pretty stumped on this as i have not updated anything or even installed new plugins that would cause this conflict.

          • It would help a lot if I could take a look at your site. But check your search form or eCommerce plugin settings to see if the search is not excluding post types.

          • Mikko,

            I appreciate your support, especially since it was free and you did it in your spare time. However i have since purchased a plugin specifically for wp-ecommerce product search. Thanks again!

  • I get no results from relevanssi after I upgraded to the latest version. even when I disable the plugin I get no results in the search page. Anything I should be checking? I’m using this plugin with jigoshop to search products. the post type is “product” and I checked it in the settings page to be indexed.

    • Is your search set to search products? Check both your search form and the Jigoshop settings.

  • Claudia Dinner um 8

    first of all I’m a foodblogger from Germany and not a developper. I was using Relenavanssi succesfully during the past month but now I get an “error 404 page not found” after entering a search criteria. How can a dummie like solve that problem?
    I’m using 3.1.3.
    thanks so much.

    • Claudia Dinner um 8

      a dummie like me, that’s what I wanted to say.. 🙂

      • Your search form has an error. It comes up with a URL like this: when would work.

        Your searchform has:

        <form id=”searchform” action=”?php bloginfo(‘url’); ?” method=”get”>

        when it should have:
        <form id=”searchform” action=”<?php bloginfo(‘url’); ?>” method=”get”>

        • Claudia Dinner um 8

          thanks so much for the hint. I have changed the code, but it did not do the trick…. any other ideas?

          • You copied the code incorrectly. Make sure the code looks exactly like I posted it. It doesn’t, right now. Do not use copy-paste, but write it yourself. Make it look exactly like in my example.

          • Claudia Dinner um 8

            thank you so much for your kind support. I did not copy the code – I typed it. Still it does not return any results. It says that possibly the page has moved. Could it be that somewhere in the function bloginfo(‘url’) there is an invalid path? could it be that I have to change it somewhere on the DB? or in one of the files?

          • No, the code is wrong. I can’t write the code here, because the comment form mangles it, but it starts (ampersand)lt;?php when it should have (less-than-sign)?php. In the end there’s (ampersand)gt; where a greater-than sign should be. If you’ve written less-than signs and greater-than signs instead of the codes, then you’re using an editor that cannot be used to modify HTML code, and you need an editor that doesn’t ruin PHP code.

        • Claudia Dinner um 8





          that is what I copied from the search form

        • Claudia Dinner um 8

          sorry please delete previous post. copied the wrong text

        • Claudia Dinner um 8


  • PeterTheta

    WP 3.5.1, 18 posts, 48 pages
    First ever Relevanssi install, all settings default
    I have indexed
    I looked through search.php and loop.php and did not find query_posts()

    Page title ‘About Us’ with permalink /about cannot be found by searching ‘about’, ‘about us’, etc.

    Possible issue:
    The server is IIS7, with .htaccess fix for permalinks. – yeah, it’s bad but I can’t change it


    • “About” might be a stopword. Check the stopword list. I don’t think it’s a huge problem – who searches for “about us” page of a site, with those words? I don’t think many people do.

      • PeterTheta

        It’s not too big a site so removing the stopwords ‘about’ and ‘us’ shouldn’t be a problem. And, so far, it looks like we’re in great shape. You have another follower, thanks!

  • soloreglasgolf

    I´ve running relevanssi for last 4-6 months.
    Everything seems to be OK. Plugin was updated two-three times without any problem.
    But I´ve just updated to version 3.14 and Relevanssi doesn´t work: when searching nothing is found.
    I´ve rebuild the index and deactivate-activate the plugin but problem remains.
    When deactivating elevanssi standard WP search works OK.

    I´m running WP 3.5.1

    Any suggestion how to fix the problem?


    • Which version did you update from?

      • soloreglasgolf

        I´m not completely sure but since I use to update plugins asap I guess I was running 3.1.3.

        • In that case it’s hard to say – might be a conflict with your other plugins.

          • soloreglasgolf

            Have you got a list of plugins with known conflicts with Relevanssi?
            Thank a lot!

          • No, I don’t have a ready list, there are too many other plugins.

  • Dasher

    I need help. I’m not seeing any results in the results page. I’ve used Relevanssi in the past (another blog), it worked, so I’m almost sure this has something to do with my theme (

    I copy/pasted the codes here:

    Can you please tell me what to change? Thanks and I appreciate your hard work.

    • At least those codes have nothing unusual. ar2_above_content() might have something in it, but I’m not sure. And you’ve tried deactivating and reactivating the plugin and reindexing the content? Indexing works well?

  • Lars


    there are no documents in the index.

    $wpdb->print_error(); Shows no error. So I debugged a query and tried to execute in in phpMyAdmin. The result was an error:

    #1136 – Column count doesn’t match value count at row 1

    Can I post (the very long) query here?

    BTW: We use a Multisite Installation.


    • Lars, if you have free version on a multisite, that’s your problem there – you can’t use the free version of Relevanssi on multisite, it’s just not compatible.

      • Well, that’s strange. I came here looking for help with a problem similar to the original poster: ie. Relevanssi works great on my development laptop but doesn’t seem to be able to build the index on my live server. Both WP setups are the same, as I use git to sync changes between the dev and production servers.

        The thing is, I’m using WP multi-site and Relevanssi most definitely *does* work –at least on my development machine. Unfortunately just not on the production server.

  • Matt

    Hi. My Theme company ( specifically recommended Relevanssi to use with their theme, “Origin.” They recommended Relevanssi to me because the standard WP search only returned search results from “posts” (but not “pages”).

    I am not seeing any different behavior from Relevanssi, so I think it’s not working at all. I looked for “query_posts()” within my search result page (search.php), but found none. However, I am not a developer, so perhaps I am not looking correctly.

    Here is the source for search.php. Do you see anything I should change?




    <a href="”>

    <?php if ( $thumb ” && !$et_ptemplate_showthumb ) { ?>

    <a href="”>

    <a href="” class=”readmore”>

    • Matt

      Hmmm. my full page is not showing here, but when I click “edit” it shows… Can you see it? Or should I email it to you?

      • If both Relevanssi and default WP search are returning only posts and not pages, you have the post_type set to ‘post’ somewhere. Since your theme designer recommends Relevanssi as a solution, I suppose it’s not in the theme.

        The best way to share template pages is to put them in a pastebin. You generally can’t copy and paste HTML and PHP code to comment forms and have it stay intact.

        If you buy a Premium license, I’ll be glad to see how to get things working on your site; unfortunately there are limits to how much I can help people who are not Premium subscribers. If you show me your search results template and functions.php files, I can take a look at them and see if it’s something obvious.

  • Nasya Jyoti Demich

    Hello! i have a theme Infocus (themeforest) which seems to be not compartible with free version of Relevanssi as it is… so my question is: if i’ll buy the pro version of relevanssi will that fix the problem? or will i have support to fix that? i tried to find query_posts() in my theme files but i didn’t find anything like this…
    what could be done fore better search results on my web-site ( thank you!

    • Switching to Premium won’t change anything: it’s that similar to the free version. If you buy Premium, I can take a look at the theme, but I can’t promise that I can make it work with Relevanssi, and the support doesn’t include complex changes in your theme to make it compatible with Relevanssi.

      Usually the problematic themes are fairly easy to fix, but not always. The more complicated a theme is, the harder it is to fix. If you can send me the search results template from your theme (usually it’s search.php), I can take a look at it and let you know if it looks like an easy job or a difficult one. My email is

  • Terskac

    I have a Tab on a page titled FAQs. FAQ and FAQs does not show up in the results. Neither do any of the other tabs on that page. Any ideas how I can fix this? I also noticed that a single search usually shows that it has been searched twice within a few seconds of each other. The results are doubled too.

    • It’s quite possible the contents of your tabs are invisible to Relevanssi. It all depends on how they’re done. Is it a shortcode? Or something else?

      What comes to doubling of search results, that sounds like a problem with your search results template.

  • Hi,

    I have installed Relevansii with theme Twenty twelve and it works perfectly.
    But in another installation with plugin WPML and theme Construct a problem appears: Relevansii builds an Index but searches do not provide any results.

    In WP control panel > Relevansii > settings I have enabled Polylang
    On server… / WP content > plugins > Relevansi I renamed the directory to and the file to . Is it correct?

    My theme’s file Search.php is available at if you like take it a look.

    I have no experience as a developer and work for a non-profit organization. Can you help me to solve this problem, please?

    • The link to is not working, so just paste the plain URL here, without any HTML codes. Sounds like a problem with the search template, yes.

      • Hi, MS here it is:

        • Ah, it’s a framework theme. Those are always more complicated to debug, as that template file contains nothing of use – the actual search page template is inside the mysite_search() function. Where that is, I don’t know. I can’t usually do much of a support for framework themes.

          • Thank you, M. So I go to ask about in the Forum theme support and if I get results, come back. In any case, I congratulate you and thank you for your work.

          • Hi, M. this is the framework response ???:
            “We use the query_posts, you can find it in various areas in the
            theme.php file. It’s used for lots of areas in the theme such as
            excluding categories, portfolios, etc etc.

            It would probably be best to try and find another plugin.”

          • Ok, so this sounds like switching search plugin or theme is the easiest solution here. I suppose Construct and Relevanssi can be made to work together, but it’s not going to be easy, and it’ll require changes to Construct files.

          • I share your opinion, Mikko.

            I have passed your answer to Construct-framework developer (Mysitemyway) or which suggest me how can I Boolean and advanced search with its product Construct.

            This is his response: “You would need a plugin or hire a custom freelancer to do that customization.”

            Is it really necessary to hire a freelancer? As you know, we have no budget in this organization now =(

          • Well, unless you find someone to do it for free or do it yourself, then yes, you have to hire a freelancer. I know it’s complicated enough that I can’t do it for you for free.

          • I appreciate your opinion. I will discuss the case with the Foundation liable and if they have money, I will talk to you. Thank you

  • rodrigord

    Hi I just updated to the last version and started getting mysql errors. I am not really sure what version I was but it was a recent one.

    MysqlError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts W’ at line 2

    Sample stack trace

    …mysql_query called at /var/www/ (1213)
    …wpdb::query called at /var/www/ (1538)
    …var/www/ (515)
    …var/www/ (971)
    …var/www/ (42)
    in relevanssi_query called at ? (?)…

    Index looks ok, I already tried recreating it. Also tried to disable/enable the plugin again.

    • rodrigord

      Mysql version is 5.5.32

    • Is there any chance you could get me the problematic MySQL query in it’s full form?

      For example, try this code:

      add_filter(‘relevanssi_query_filter’, ‘rlv_q_f’);
      function rlv_q_f($q) {
      return $q;

      • rodrigord

        Hi Mikko, I had replied to that days ago and for some reason the reply dissapeared. Maybe because of the SQL in the comment. So I will try to send it with a screenshot. The problem is that there is some ” IN () ” in the middle of it

      • rodrigord

        Here is the screenshot

      • rodrigord

        Yes, there is no way to paste an SQL statement here

  • Greg Jones

    Hi, your plugin displays my category results fine which i need, however it only displays the posts images and not the full text, I only see ………….
    in the result and no text. Any idea how to fix it , thanks Greg.

    • Relevanssi doesn’t actually have much to do with what you see on the search results page, that is up to your search results template. Check your search results template.

  • jeff00seattle

    “Appearance of new WP_Query() is another sign of trouble, or $wp_query->get_posts();. Anything that queries the database for new posts is trouble for Relevanssi.”

    It is not clear by this comment if a theme has this within its code if this is a show-stopper not to use Relvanssi. Please provide what is the resolution if found.

    Thank you

    I am using theme Docs, and it contains:

    function have_posts() {
    global $wp_query;
    return $wp_query->have_posts();

    which is called within docs/index.php:

    query_vars[‘post_type’]); ?>

    ID );
    if ( $post_type == ‘post’) {
    get_template_part(‘templates/post’, ‘loop’);
    } elseif ( $post_type == ‘page’) {
    get_template_part(‘templates/page’, ‘loop’);
    } else {
    get_template_part(‘app/’ . $post_type, ‘loop’);

  • Matia

    My template uses “WP_Query()”, when I comment it out though it breaks the whole template. Should it be replaced with something else?

    • Yes, commenting out is not enough. Can you post your template to a pastebin?

  • Bram


    We have a custom taxonomy archive which shows no results when the Relevanssi plugin is enabled, without the plugin everything is fine.

    In this taxonomy archive we have a query_posts to change the order of the items.

    How can we make sure Relevanssi only does it’s thing on the search page and not on he taxonomy archive (or any other page)?


    • This is a WP 4.0 feature. This code in your functions.php should solve the problem:

      add_filter(‘relevanssi_prevent_default_request’, ‘rlv_fix_archive_kill’, 10, 2);
      function rlv_fix_archive_kill($kill, $query) {
      if (empty($query->query_vars[‘s’])) $kill = false;
      return $kill;

      • Bram

        Hi Mikko,

        Thanks for your help!

        I’ve added the code to my functions.php and it actually does what it is supposed to do (not replacing the request with “SELECT * FROM $wpdb->posts WHERE 1=2”).
        But the taxonomy archive still displays no results, so I think it must be something after that.

        Any ideas?


        • Try debugging the file lib/search.php; Relevanssi process starts in the relevanssi_query() function. What that function does on your archive pages?

          • Bram

            In relevanssi_query() $search_ok is true so $posts gets modified, but even when I edit the function to return $posts as it is there are no results.

            At this point $posts contains the right results.

            Weird thing is that on the taxonomy archive page is_search() returns true after query_posts, before query_posts it returns false.

          • Does it help if you do unset($wp_query->query_vars[‘s’]); on the archive page?

          • Bram

            Yes! That fixed it!
            Thank you very much!

      • kray257

        Mikko, I am running into this same issue, but the page is an ajax call. It doesn’t seem to be firing the filter because it’s on a blank template, due to it being an ajax call. Can you please tell me how to apply this fix for an ajax call?

  • Gaurav Agrawal

    Hi. I am using implicit theme in WordPress version:4.0 for my website. And when I use these plugin in my theme it does not show any search results.And when I change the theme it works properly and show all results.

    Can any one help me??

    • Well, did you read the instructions on this very page?

      • Gaurav Agrawal

        yes, I have tried all suggestions and read all conversations but still its not working for me.

        • Please post your theme search results template (usually search.php) to a pastebin and share the link.

          • Gaurav Agrawal

            2) {

            foreach($builders as $builder) {



            } else {

            echo do_shortcode(‘[blog title=”Blog” icon=”magazine”]’);



          • Gaurav Agrawal
          • Ok, that looks unusual. Sorry, I can’t help you with that theme, I don’t understand what that does.

          • Gaurav Agrawal

            Ok, Thanks for your reply.

            But can you suggest me any option through which i can get some clue??

          • I’d say theme support, but since this is a plugin compatibility issue, they’re not going to help you.

  • Hassan Nawaz

    please help how to remove search results query code to fetch the results from this search..please help..this is my search results whole code ..what to remove?

    (found_posts; ?>)

    <a href="”>

    <?php get_footer();

    • Hassan, please post the complete code to a pastebin, looks like the comment form has eaten part of the code. If that is all the code, then your template is missing several required parts.

  • Lia Vo

    Hi Mikko! How do I replace the query so that the plugin works? thanks!

    • Lia, no need to make changes, that search results template is Relevanssi-compatible.

      • Lia Vo

        but it doesn’t work! search turns out no results…:(

        • Lia, the problem is then in somewhere else. Have you built the index? Are the correct post types being indexed?

          • Lia Vo

            oh, sorry, now it’s ok! thanks!


    Hello, we are using the premium version of this plugin.

    In search results, we see the tag pages (we like that a lot) but when you click on the tag page title to see it, the link to all of these tag page results is just the home page. What can we do to have the link actually go to the tag page?

    Here’s an example:


    • Hi, since you’re a Premium member, please use the Premium support service – it usually gets answers faster.

      Anyway, changing the_permalink() on search results template to relevanssi_the_permalink() should do the trick. If this doesn’t work, please reply to the support email address (you can find on the sidebar in the Relevanssi settings page).

  • Eric

    Hi,Mikko,help me with this problem.I want my clients to search something in my portfolio posts,that is where I put my product in.It seems like I can just search the words in the tittle!When I search some words in my portfolio posts,nothing appeared!I already set to index portfolio,but still I can’t search words in my portfolio posts but not in the tillte.Can you tell me how to work?

    • Not with this information. If Relevanssi can’t see the content of posts, it may be because you’re using shortcodes or page builders to create the content. Or is the content perhaps in a custom field?

  • Mwea

    Hi !

    Just installed your plugin, it looks really great but i cant get any result on my search page.. Can you give me any advice to solve this problem ?

    Here is the code of my search template :

    Regards !

    • Nothing seems obviously wrong, but it’s a complicated enough template that I can’t say for sure.

  • I only see this message “Enable query logging to see stats here.” and an empty page. What should I do to see sth?

    • You should enable query logging, if you want to see the stats. If you want to see Relevanssi settings, you need to go to Settings > Relevanssi.

  • 醉拳

    Hei Mikko,

    are query terms sanitized in Relevanssi?

    • That video is based on Relevanssi 2.7.2. The vulnerability was fixed in 2.7.3, and Relevanssi has since been checked to make sure that all user input goes through necessary security measures.

  • kowdermeister

    This could be a great help resource if you would actually share what code to use besides what’s known not to work.

    • Ah, but that’s the thing: there is no code necessary. The default search results template (see for example WP default themes) works fine. If you have a problematic code (as mentioned in the post), just remove it, and usually you don’t need to add anything.

      • kowdermeister

        That’s true, if you have a default WP install. I had to develop in Timber + Bedrock, it’s a fork, slightly different, search uses. WP_Query in that version. If I remove that, obviously nothing will happen 🙂

        The answer would be:
        “Direct access to query engine”

        I’ll use that, it would be better to add it to a tutorial page.

        • That is very much beyond any basic tutorials. But since you’re a developer, it’s not that hard to use, really. Create a WP_Query object with the parameters you want and pass it to relevanssi_do_query(). If your WP_Query object is called $query, the results will be in $query->posts afterwards.

          • kowdermeister

            Yeah, thanks, I’ve read it in the FAQ, looks simple enough. I’m just suggesting to improve the docs, because it was very confusing for me, I found the FAQ by accident.

            I don’t really know WP works, some code snippet or search.php setup might help people.

  • Danil


    using momizat multinews theme. I’ve tried to comment out WP_query, commented all out, but no result (or broken pages).Here is the search.php code

    Can you help me?

    • You must also change $query->have_posts() to $have_posts() and $query->the_post() to $the_post().

      • Danil

        Fatal error: Function name must be a string in /home/histor69/public_html/wp-content/themes/multinews-child/search.php on line 181

        That is a if ( $have_posts() ) line….

        • Sorry, have_posts() and the_post(), not $have_posts…

          • Danil

            Real respect for the fast answer. Unfortunately, did not help. No results are returned…

          • Your theme has enough modifications in the search results template that making it Relevanssi-compatible will require more work. Unfortunately some themes are like that.

  • pirmvien

    Where to change “Search” button name in my language?

    • I don’t know. It’s not coming from Relevanssi, but your theme.

    • eike

      it is from either searchform.php or, in some cases, in heading.php.

  • Hi, my search stopped working for some reason… It doesnt show ANY results… but it did few days ago. I’m not aware of any changes.

    I put this line in my search.php: global $wp_query; var_dump($wp_query->query_vars);

    And this is the result, but I’m not clever from that:
    [“author_name”]=> string(0) “” [“feed”]=> string(0) “” [“tb”]=> string(0) “” [“paged”]=> int(0) [“comments_popup”]=> string(0) “” [“meta_key”]=> string(0) “” [“meta_value”]=> string(0) “” [“preview”]=> string(0) “” [“sentence”]=> string(0) “” [“title”]=> string(0) “” [“fields”]=> string(0) “” [“menu_order”]=> string(0) “” [“category__in”]=> array(0) { } [“category__not_in”]=> array(0) { } [“category__and”]=> array(0) { } [“post__in”]=> array(0) { } [“post__not_in”]=> array(7) { [0]=> int(889) [1]=> int(601) [2]=> int(188) [3]=> int(880) [4]=> int(9) [5]=> int(757) [6]=> int(874) } [“post_name__in”]=> array(0) { } [“tag__in”]=> array(0) { } [“tag__not_in”]=> array(0) { } [“tag__and”]=> array(0) { } [“tag_slug__in”]=> array(0) { } [“tag_slug__and”]=> array(0) { } [“post_parent__in”]=> array(0) { } [“post_parent__not_in”]=> array(0) { } [“author__in”]=> array(0) { } [“author__not_in”]=> array(0) { } [“meta_query”]=> string(0) “” [“posts_per_page”]=> int(-1) [“ignore_sticky_posts”]=> bool(false) [“suppress_filters”]=> bool(false) [“cache_results”]=> bool(true) [“update_post_term_cache”]=> bool(true) [“update_post_meta_cache”]=> bool(true) [“post_type”]=> string(3) “any” [“nopaging”]=> bool(true) [“comments_per_page”]=> string(2) “50” [“no_found_rows”]=> bool(false) [“search_terms_count”]=> int(1) [“search_terms”]=> array(1) { [0]=> string(3) “DWG” } [“search_orderby_title”]=> array(1) { [0]=> string(40) “acadblogwp_posts.post_title LIKE ‘%DWG%'” } [“order”]=> string(4) “DESC” }

    • Hah, nevermind… I had new plugin from colleague: “Post Types Order”
      And that did it… :-/

  • Nicole DeVries

    I’ve installed Relevanssi and built the index, but I cannot figure out how to make a search bar show up on my site anywhere. Any tips?

    • Just use the WordPress default search widget.

      • Nicole DeVries

        Thanks! That makes sense. It’s working now!

  • KevTheSmeg

    Hi. I’m sure this is a dumb question but I’m new to this and i don’t see any difference in the search function am i doing something wrong in the code? i just installed the plugin and created the index but the search isn’t any different?

    • Your theme is probably incompatible with Relevanssi. You can try switching to a default theme for a while – does the search have an effect then?

      • KevTheSmeg

        thank you for the really quick reply. I’ve just checked my custom mobile menu its working on that but not in desktop. I’m using Labomba is there any known issues with this theme do you know?

        • First time I’ve heard of the theme, so I don’t know. Does Relevanssi work with one of the default themes? In that case it’s a theme incompatibility, which most of the time can be fixed with the instructions on this page.

          • KevTheSmeg

            ah right ok. No i cant change my theme because of the one of the links to woocommerce. ill try and redefine the search term for the desktop because i know the mobile menu has a different term to the desktop. once again thank you for the quick reply!

  • Varvara Jones

    I am attaching our search.php and I am not at all sure what stopped working after the latest update. There’s no query_posts or anything like that, and me being a very begginer WP user, I’m at a loss.


    • There is no problem with that template. Have you tried switching to one of the default themes and disabling other plugins to rule out conflicts?

  • msi

    Hi. I try to search for a woocommerce article number (sku).

    The sku ist saved in a format like this: 978-3-3801-1010-3 but can also be shorter for example 971-4-313-334-1. If the user search exactly for this string, the product will be displayed. But often the user searches for the number without the “-“. Then the product will not be displayed. The fuzzy-search is active.

    Do you know any workaround, to display the correct product also if the user searches for the sku without the “-“?

  • Alex

    Thank you for your great plugin.

    I have a plugin (User Gallery Lite for Ultimate Member) and would like to use this plugin with Relevanssi plugin but unfortunately Relevanssi plugin can’t find this plugin (User Gallery Lite for Ultimate Member) in Indexing option table and can’t index my images when I upload them to database. Can you please help me to modify your code in order to find the plugin in indexing option table?

    • Sorry, can’t help you there. If the images are not a custom post type, but instead in a separate database table, Relevanssi has no access to them, and it’s really difficult to fix.

  • Lexie Vean

    I am so sorry this is elementary, but I do not know how to get the this search functionality on my top navigation bar next to Contact? Any help appreciated. I have installed and activated the plug-in.

  • Alex


    I was wondering whether your plugin can index more than 100,000 images? If no, what plugins you suggest for large database?


    • No, it’s way too much for Relevanssi. Use Solr.

  • Corey Taylor

    How do I fix the search button being misaligned with the text box. I know this is something simple but I just don’t know what to do.

    • Can’t really help just based on image; seeing the site and the CSS code would help. But this is not Relevanssi-specific, anybody with CSS skills can help you with this.

  • Guest 1

    How can i give the post title the first priory in the relevanssi order?

    • Increase the title weight in Relevanssi settings.

  • Ben

    Is there a link to adding images to search return? I am trying to differentiate between products and posts, and images would help greatly but I can’t get them to populate. And I can’t find a post about this issue.

  • Ben

    Is there a link to adding images to search return? I am trying to differentiate between products and posts, and images would help greatly but I can’t get them to populate. And I can’t find a post about this issue.

    • The post type is stored in $post->post_type. You can use that to display different images for products and posts.

      There’s no documentation about this here, because it’s not a Relevanssi issue, but instead depends on your theme.

  • Corbett

    I am having an issue with searches on the front end of our website. When I enter the SKU #, description, name, and/or keywords into the product tags, Relevanssi usually pulls up the product I am looking for, but if I don’t have any tags entered in, it won’t find the product. Usually not even close, either. The back end works just fine, but I can’t pull up the product I’m looking for on the front end of the website. Short of entering tags for every product, I don’t know what to do. Any suggestions?

    • Are you sure the search is powered by Relevanssi in the first place? If you disable Relevanssi, does that make any difference at all in the search?

      In order for Relevanssi to find products by SKU, you must adjust Relevanssi settings so that the “_sku” custom field is being indexed. Have you done that?

      • Corbett

        I wasn’t the one to initially set it up, so I’m not sure what was done. I did try disabling it, and re-enabling it, and both did little to nothing. How do you adjust the sku custom field?

        • Add “_sku” to the list of custom fields to index, rebuild the index. That should do the trick. But disabling Relevanssi should modify the search results, if they are powered by Relevanssi, so if nothing happens, they’re not.

          • Corbett

            Where would I locate the list of custom fields? Is there any way you can post a screenshot of what you’re talking about? I’m sorry, I am learning about all this as I go. I’m in no way a coding expert. Thanks for your help.

          • Go to the Relevanssi settings page and look at the indexing settings – you’ll find it there.