Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter Erich

    (@erichboileau)

    Before the feature request was filled, I was using this code to achieve the result on my site. Don’t know if would be helpful or not. ?? Of course, this method includes whereas you would need to exclude.

    function customSearchFilter($query) {
    if ( !$query->is_admin && $query->is_search) {
    $query->set('post_type', array('post', 'page') );
    }
    return $query;
    }
    add_filter( 'pre_get_posts', 'customSearchFilter' );
    Plugin Author Evan Herman

    (@eherman24)

    Are announcement posts still appearing in your search results? Toggling the setting should be enough to include/exclude them from searches.

    During the register_post_Type call I set exclude_from_search to the setting from the options page.

    Evan

    matc

    (@matc)

    Yes, they are still appearing, even when set to false.

    Can confirm that this is for both new and old announcements. Have toggled the setting a few times now!

    Plugin Author Evan Herman

    (@eherman24)

    Hi Mat,

    On my end it seems to be excluding the announcements when Include is set to ‘True’ , which is the reverse of what it should actually be.

    Do you have some sort of caching plugin installed? What theme are you running? It could be directly related to your site, specifically.

    I will have to push out an update that changes ‘Include’ to ‘Exclude’ for the setting to be correct.

    Thanks,
    Evan

    matc

    (@matc)

    Hello again. No cacheing plugin and the theme is ‘Politicize’.

    And you’re correct, it is working, just in reverse!

    Mat

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Feature Request: Exclude from Search’ is closed to new replies.