Support » Plugin: Relevanssi - A Better Search » [Plugin: Relevanssi – A Better Search] Filter by "page" post type issue

  • Resolved joero4ri

    (@joero4ri)


    I just installed the latest Relevanssi on my site, and everything is working perfectly except for one thing. I would like to have a list of post types that the user can filter there search results on. I have the list and and it all works except for one post type… the “page” post type. Users can filter based on the “post” post type and event my custom “event” post type, but when the user clicks on the link to filter by the “page” post type, all results are returned. Any ideas?

    Here is the querystring…
    ?post_type=page&s=test <– returns all results
    ?post_type=post&s=test <– returns just posts

    http://wordpress.org/extend/plugins/relevanssi/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    I was going to say I had the same problem, but then I noticed I didn’t have Relevanssi activated on my test blog. Once I activated the plugin, the problem went away and everything works like it should.

    Now, that raises the question: are you sure your search results are provided by Relevanssi? Because the way Relevanssi is coupled with WordPress is a bit fragile, it can be thrown off by something small like a single query_posts() call on the search results page.

    Thread Starter joero4ri

    (@joero4ri)

    I looked in my search results page and found no reference to query_posts(). I checked my results with Relevanssi deactivated and my search results are in a different order (by date). Activated Relevanssi again, and my search results changed. It seems strange that I can set my post_type to post or event, and my search results get filtered perfectly, but once I set it to page, everything comes back.

    Thanks for responding, I do believe that Relevanssi is returning my search results, is there anywhere else I should be checking?

    Thanks again.

    Plugin Author Mikko Saari

    (@msaari)

    That’s a strange thing… Sorry, I don’t have any more ideas. Maybe you could put a

    var_dump($wp_query);

    somewhere on your search results page to see if the post_type parameter is passed correctly.

    Plugin Author Mikko Saari

    (@msaari)

    Oops, looks like I’m having the same problem as well.

    I’ll see what’s going on. Meanwhile, I can give you a quick fix: use post_types instead of post_type. That one works for me.

    Plugin Author Mikko Saari

    (@msaari)

    Looks like trying to set the post_type to “page” makes WordPress set it to “any”. This is some sort of WordPress trickery that Relevanssi can’t do anything about – since WP changes the value, Relevanssi can’t tell when the user really means “any” or not. I don’t think this has happened before, so it might be a new feature of 3.3.

    Anyway, this is a WP feature that can’t be fixed in Relevanssi, so you need to use the post_types query variable to circumvent this. That one is introduced by Relevanssi and won’t be touched by WP.

    Plugin Author Mikko Saari

    (@msaari)

    Thread Starter joero4ri

    (@joero4ri)

    Using the post_types fixed my problem. Sorry I’m getting back to you so late. Thanks for the quick response.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] Filter by "page" post type issue’ is closed to new replies.