• Hello,
    I’ve been struggling with something that ought to be simple to do…but failed to find the solution.
    There exists an earlier post that shows how to restrict the search to a single post type by adding an input field. That is really nice.

    Now, there remain two questions for me:
    1- how do you restrict the search to multiple post types ? (as in, I want results only of type A or B)
    2- how do you *exclude* one or more post types from search results? (as in, I want results except of type C or D)

    I’m posting here in the hope that the answers will remain available for whoever wants to use this great plugin!

    Cheers
    Palijn

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Palijn

    (@palijn)

    I’ll answer to myself after having dug into the code:

    1- you restrict the search to multiple post types by adding a hidden “post_type” input into the search form, or by listing the post types in the administrative interface.
    Warning: the english version of the admin page is right, you ought to list the post types by their DB name, separated by a comma , to include these post types. That’s the same with the post_type input.
    The French version is the other way around – and plain wrong.

    2- you cannot exclude post types in the search results: the code simply does not implement it , as of Relevanssi 2.5.5 .
    I’m now looking into implementing the “prepend minus to exclude” tip to match the taxonomies behaviour.

    If you do implement it, I’d appreciate a patch.

    Actually, don’t bother – version 2.5.6, out soon, will allow excluding post types.

    Hello, I’m the french translator of the plugin. As I did not find where the translation error was located, could you give me the exact english sentence so I can correct this ? Thank you.

    Thread Starter Palijn

    (@palijn)

    Wow. That is being reactive, I’m impressed ??

    Li-An , the exact sentence in the admin panel is :
    Si vous ne désirez pas indexer tous les types de billets personnalisés, listez ici les types de billets personnalisés que vous ne désirerez pas indexer.

    which should IMHO read:
    Si vous ne désirez pas indexer tous les types de billets personnalisés, listez ici les types de billets personnalisés que vous désirez indexer.

    to match the English sentence, which reads :
    [...] list here the custom post types you want to see indexed

    and to match the actual behaviour of the code ??

    Thanks a lot for your hard work!

    Merci Palijn pour cette correction. Malgré tous mes efforts pour donner la meilleure traduction possible, j’avoue que je les réalise souvent dans les moments de “trou” et je ne suis pas toujours aussi concentré que je le devrais. Je m’excuse auprès de utilisateurs fran?ais de cette bourde…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Relevanssi]How to exclude/include multiple custom post types in search?’ is closed to new replies.