Search Exclude

Description

With this plugin you can exclude any page, post or whatever from the WordPress search results by checking off the corresponding checkbox on post/page edit page.
Supports quick and bulk edit.

On the plugin settings page you can also see the list of all the items that are hidden from search.

Présentation

communauté de QuadLayers

Captures d’écrans

  • screenshot-1.png
  • screenshot-2.png

Installation

  1. Upload search-exclude directory to the /wp-content/plugins/ directory
  2. Activer l’extension via le menu Extensions dans l’admin WordPress
  3. Go to any post/page edit page and check off the checkbox Exclude from Search Results if you don’t want the post/page to be shown in the search results

FAQ

Cette extension affecte-t-elle le référencement ?

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.

Si vous souhaitez que les publications/pages soient masquées pour les moteurs de recherche, vous pouvez ajouter l’extrait suivant à votre functions.php :

function add_meta_for_search_excluded()
{
    global $post;
    if (false !== array_search($post->ID, get_option('sep_exclude', array()))) {
        echo '<meta name="robots" content="noindex,nofollow" />', "\n";
    }
}
add_action('wp_head', 'add_meta_for_search_excluded');

Note : les pages déjà indexées le resteront pendant un certain temps. Afin de les retirer de l’index de Google, vous pouvez utiliser Google Search Console (ou un outil similaire pour d’autres moteurs).

Existe-t-il des crochets ou des actions permettant de personnaliser le comportement de l’extension ?

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', 'exclude_new_post_by_default', 10, 2);
function exclude_new_post_by_default($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

En retournant true ou false, vous pouvez activer le filtrage de la recherche respectivement.

Exemple :
Supposons que vous ayez besoin de désactiver le filtrage de la recherche si vous recherchez un post_type spécifique.
Dans ce cas, vous pouvez ajouter le code suivant à votre fichier functions.php :

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

Avis

11 juin 2025 2 réponses
We wanted to remove a lot of administrative pages and duplicate custom post things from our search results, and this did the trick. I’d like to give 4.5, and only knock off a little because of the Settings Page:(a) the Documentation link to their quadlayers.com site is 404(b) It says IDs on the Settings page but it’s really an even better Post Name picker. I needlessly went looking up IDs before I realized that, so a little better explanation of the Settings page would make it 5 Stars in my book!
7 juin 2025 1 réponse
For all of those confirmation pages and others that you don’t want showing up in WordPress searches, this is perfect. Also helpful if you just want to publicly test a page without anyone discovering it.
7 juin 2025 1 réponse
I added code to the theme.php file, and it did not work. I searched for a plugin, and I am so happy that I found yours. It is so simple to use. I give it TEN stars!
Lire les 193 avis

Contributeurs/contributrices & développeurs/développeuses

« Search Exclude » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

“Search Exclude” a été traduit dans 5 locales. Remerciez l’équipe de traduction pour ses contributions.

Traduisez « Search Exclude » dans votre langue.

Le développement vous intéresse ?

Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.

Journal des modifications

2.5.2

  • fix: update dependencies

2.5.1

  • fix: update dependencies

2.5.0

  • fix: security issues

2.4.9

  • fix: load plugin textdomain

2.4.8

  • Compatibilité WordPress

2.4.7

  • fix: terms exclusion
  • fix: Content Control plugin compatibility

2.4.6

  • fix: update readme.txt

2.4.5

  • fix: search exclude in ajax

2.4.4

  • fix: load plugin textdomain

2.4.3

  • fix: search exclude documentation url

2.4.2

  • fix: update jetpack autoload

2.4.1

  • fix: php errors

2.4.0

  • fix: implement jetpack autoload

2.3.0

  • fix: php errors
  • fix: improve allowed screen logic
  • fix: scripts in custom post types
  • fix: advanced custom fields compatibility

2.2.0

  • fix: php errors

2.1.9

  • fix: php errors
  • fix: compatibility with classic editor

2.1.8

  • WordPress 6.7 compatibility

2.1.7

  • fix: WordPress 6.1.3 compatibility
  • fix: big queries
  • Remove notification

2.1.6

  • Refactor update

2.1.5

  • Refactor

2.1.4

  • Compatibilité WordPress

2.1.3

  • Compatibilité WordPress

2.1.2

  • Compatibilité WordPress

2.1.1

  • Packages update

2.1.0

  • Compatibilité WordPress

2.0.9

  • fix: PHP errors

2.0.8

  • Translation strings

2.0.7

  • Compatibilité WordPress

2.0.6

  • Compatibilité WordPress

2.0.5

  • Mise à jour du lien vers le portfolio

2.0.4

  • Compatibilité WordPress

2.0.3

  • Corriger les chaines de traduction

2.0.2

  • Corriger les chaines de traduction

2.0.1

  • Corriger les chaines de traduction

2.0.0

  • i18n implémenté
  • Composer implémenté
  • Autoload implémenté
  • Renommer les fichiers pour les adapter aux règles de développement de WordPress
  • Renommer les classes pour les adapter aux règles de développement de WordPress
  • Renommer les variables pour les adapter aux règles de développement de WordPress

1.3.1

  • Mise à jour de l’auteur/autrice.

1.3.0

  • fix: and rework bulk edit: The Bulk actions dropdown now offers hide/show actions.

1.2.7

  • This is a security release. All users are encouraged to upgrade.
  • Corrige une possible vulnérabilité XSS.

1.2.6

  • Corrige la compatibilité avec WordPress 5.5

1.2.5

  • Security release. More protection added.

1.2.4

  • Security release. All users are encouraged to update.
  • Added filter searchexclude_filter_permissions.

1.2.2

  • Added action searchexclude_hide_from_search
  • Added filter searchexclude_filter_search
  • Fixed Bulk actions for Firefox

1.2.1

  • Fixed bug when unable to save post on PHP <5.5 because of boolval() usage

1.2.0

  • Added quick and bulk edit support
  • Tested up to WP 4.1

1.1.0

  • Tested up to WP 4.0
  • Do not show Plugin on some service pages in Admin
  • Fixed conflict with bbPress
  • Fixed deprecation warning when DEBUG is on

1.0.6

  • Fixed search filtering for AJAX requests

1.0.5

  • Not excluding items from search results on admin interface

1.0.4

  • Fixed links on settings page with list of excluded items
  • Tested up to WP 3.9

1.0.3

  • Added support for excluding attachments from search results
  • Tested up to WP 3.8

1.0.2

  • Fixed: Conflict with Yoast WordPress SEO plugin

1.0.1

  • Fixed: PHP 5.2 compatibility

1.0

  • Version initiale