WordPress.org

Ready to get started?Download WordPress

Forums

WP_query not working in search template together with Relevanssi Plugin (5 posts)

  1. saschapi
    Member
    Posted 4 years ago #

    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

  2. Mikko Saari
    Member
    Posted 4 years ago #

    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.

  3. Mikko Saari
    Member
    Posted 4 years ago #

    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.

  4. saschapi
    Member
    Posted 4 years ago #

    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.

  5. Mikko Saari
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags