Support » Plugin: Relevanssi - A Better Search » exclude custom post types

  • ytmdev



    i have some cpt´s which are displayed by a shortcode that calls a loop on some pages. so if got no detail page. i´, using wpbackey for my layouts (there i add the shortcodes).

    now i unchecked the cpt´s in the index-tab of relevanssi and also tried “Excluded from search?” in the config of the cpt.

    without relevanssi, the posts are excluded
    when i use relevanssi the cpt are present in the search result

    how can i exclude the cpt´s
    i just want to display the page as a result, were the cpts entries are displayed (shortcode, loop)

    thx a lot

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


    If the custom post type is not indexed by Relevanssi, the posts cannot be returned as results by Relevanssi: they simply don’t exist for Relevanssi.

    So, something else is happening. What exactly that is, I cannot tell just from the explanation. Can you provide screenshots of what’s actually going on? How are the custom post type posts present in the search results? Do they also appear in the Relevanssi admin search (Dashboard > Admin search)?



    thx for your reply.

    this is the setting:
    this is the search link:

    The result “Japan, Hongkong, Taiwan, China” should not be displayed (cpt: auslandsvertretungen).
    Then i deactivate relevanssi “Japan, Hongkong, Taiwan, China” isnt shown in the result.

    yes, the appear in the admin serach.

    this cpt auslandsvertretungen is loop and displayed by a shortcode in a “normal” page. so i thought if i search for hongkong the page should be listet.

    thx for feedback

    Plugin Author Mikko Saari


    Have you rebuilt the index after unchecking the “auslandsvertretungen” post type? Just unchecking the post type doesn’t remove it from the index.

    yes, i have rebuild the index. still the cpt´s are dispayed, even if not checked and “exclude form search” in their init. i also checked the caching plugin so i dont get an old result.

    i´ve i don´t you relevanssi the cpt´s aren´t shown, with the plugin they are in the results.

    the cpt´s dont have a detailpage, they are just looped inside a shortcode.

    any other ideas i can check ?

    Plugin Author Mikko Saari


    If you disable shortcode expansion from the indexing settings and rebuild the index, does the problem go away? It’s likely the shortcode loop is built in a way that throws Relevanssi off the loop and makes Relevanssi index wrong post content. Disabling shortcode expansion should solve that problem.

    yes this did it. the cpts (included by shortcodes) aren´t listed anymore.

    now i´ve got the problem what a lot of content isn´t indexed because the shortcodes aren´t resolved. i´m using wpbackey.

    can this be solved somehow ?

    Plugin Author Mikko Saari


    Yes. If you can figure out the exact shortcode that is causing the problem, you can block only that. Add this function to your theme functions.php and replace shortcode_name with the name of the problem shortcode.

    add_filter( 'relevanssi_disabled_shortcodes', 'rlv_disable_shortcode' );
    function rlv_disable_shortcode( $shortcodes ) {
        $shortcodes[] = 'shortcode_name';
        return $shortcodes;
Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.