Linux 软件免费装
Banner图

Search Exclude

开发者 pronskiy
williamdodson
stevelock
quadlayers
更新时间 2024年11月29日 05:02
捐献地址: 去捐款
PHP版本: 5.6 及以上
WordPress版本: 6.7
版权: GPLv3
版权网址: 版权信息

标签

search wordpress search exclude page search exclude exclude post

下载

2.1.9 2.1.8 2.2.0 2.1.7 2.0.9 1.0 1.3.1 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 2.0.1 2.1.6 1.2.1 1.2.3 1.2.5 1.2.6 1.3.0 1.2.0 2.0.0 2.0.5 2.0.6 1.0.2 1.2.4 2.0.3 2.0.4 2.0.7 1.0.1 2.0.8 2.1.4 2.1.5 1.2.2 1.2.7 2.1.0 2.1.2 2.0.2 2.1.3

详情介绍:

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.

安装:

  1. Upload search-exclude directory to the /wp-content/plugins/ directory
  2. 通过 WordPress 的的“Plugins”菜单激活插件
  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

屏幕截图:

  • screenshot-2.png

常见问题:

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. If you want posts/pages to be hidden from search engines you may add the following snippet to your 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: already indexed pages will remain indexed for quite a while. In order to remove them from Google index, you may use Google Search Console (or similar tool for other engines).

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', '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 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'); }

更新日志:

2.2.0 2.1.9 2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.9 2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.3.1 1.3.0 1.2.7 1.2.6 1.2.5 1.2.4 1.2.2 1.2.1 1.2.0 1.1.0 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0