• Resolved Icethrill

    (@icethrill)


    I am having a problem understanding Relevanssi’s FAQ. I understand its just adding &post_type=news into the URL after the ?s parameter. But I am having trouble adding it to the search parameter in the WordPress searchform. I am not that good with the whole $_GET and $_POST.

    In your FAQ you say that you should use filters, but I would like to see some code examples how exactly these filters should be used. I just want to add “&post_type=news” when I am searching from a particular searchfield. How can I achieve that? It sounds like a dumb question, but I am having a hard time here.

    Thanks for an awesome plugin! Keep up the good work!

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

    (@msaari)

    Just add an input field with the name “post_type” and you’re set. Like this:

    <input type="text" name="post_type" value="news" />

    More useful way would be to add a select element, or a hidden input field (type=”hidden”), if you want to force the filter.

    Thread Starter Icethrill

    (@icethrill)

    Wow it worked! Didnt really think of using more input fields. Thanks for an awesome plugin and awesome support!

    Plugin Author Mikko Saari

    (@msaari)

    It’s actually a standard WordPress feature that also works without Relevanssi =) These features are not well known.

    I’m marking this resolved.

    Thread Starter Icethrill

    (@icethrill)

    Oh I didn’t know that, kinda weird I havent read about it till now. Anyway its still an awesome plugin that fixes makes the WordPress search a whole lot better. Your doing an awesome work!

    Plugin Author Mikko Saari

    (@msaari)

    I’ve been learning the features of WordPress search as I’ve gone along, they are bit of secrets for the most part it seems.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] How to filter custom post types in search?’ is closed to new replies.