WordPress.org

Plugin Directory

Search Exclude

Hide any post or page from the search results.

Does this plugin affect SEO?

No, it does not affect crawling and indexing by search engines. The only thing it does is hiding selected post/pages from your site search page. Not altering SEO indexing.

Are there any hooks or actions available to customize plugin behaviour?

Yes. There is an action searchexclude_hide_from_search. You can pass any post/page/custom_post ids as an array in the first parameter. The second parameter specifies state of visibility in search. Pass true if you want to hide posts/pages, or false - if you want show them in the search results.

Example: Let's say you want "Exclude from Search Results" checkbox to be checked off by default for newly created posts, but not pages. In this case you can add following code to your theme's function.php:

add_filter('default_content', 'excludeNewPostByDefault', 10, 2);
function excludeNewPostByDefault($content, $post)
{
    if ('post' === $post->post_type) {
        do_action('searchexclude_hide_from_search', array($post->ID), true);
    }
}

Also there is a filter searchexclude_filter_search. With this filter you can turn on/off search filtering dynamically. Parameters: $exclude - current search filtering state (specifies whether to filter search or not) $query - current WP_Query object

By returning true or false you can turn search filtering respectively.

Example: Let's say you need to disable search filtering if searching by specific post_type. In this case you could add following code to you functions.php:

add_filter('searchexclude_filter_search', 'filterForProducts', 10, 2);
function filterForProducts($exclude, $query)
{
    return $exclude && 'product' !== $query->get('post_type');
}

Requires: 3.3 or higher
Compatible up to: 4.5.3
Last Updated: 4 months ago
Active Installs: 10,000+

Ratings

5 out of 5 stars

Support

3 of 7 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

50,2,1
100,1,1
100,1,1
100,1,1
100,2,2
100,2,2
100,1,1
100,3,3
100,2,2
100,2,2
100,2,2