WordPress.org

Support

Support » Plugins and Hacks » WP_query not working in search template together with Relevanssi Plugin

WP_query not working in search template together with Relevanssi Plugin

  • When installing the Relevanssi Plugin I cannot initalize another wp_query instance. 🙁 I wanted to display a list of recent articles on top of the search results using wp_query. Deactivating Relevanssi makes it possible, but nice search results are really important…

    Any idea how to fix this issue?

    Thanks in advance Sascha

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry, no, that’s the main problem I’m having with Relevanssi. I actually tried to fix it yesterday, but found out Relevanssi makes, for example, the Recent Posts Widget to disappear for some reason.

    The search results must be the first loop on the search results page, because Relevanssi works that way – it replaces the first $posts array on pages that return true on is_search(). It has no other way of knowing where it should provide results, as WordPress doesn’t really have a proper interface for things like this.

    So, I don’t think you can get anything on top of the search results using wp_query(). Getting something in the sidebars should be possible, but unfortunately isn’t.

    Actually, removing the function relevanssi_kill() and the filter that activates it will solve many problems – but I don’t think you still can have anything before Relevanssi on a search results page.

    Thanks for your answer. This is unfortunate… 🙁 I will try some of your hints but it’s a pitty that it’s not possible to include a query in front of the search results.

    Just figure out a way to attach Relevanssi search result to any loop on the page and you’ve got it… Well, maybe they’ll do that better interface for new search engine at some point. Then it should be better.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP_query not working in search template together with Relevanssi Plugin’ is closed to new replies.