WordPress 搜索中排除特定的页面或文章分类-WordPress主题

摘要:大挖在接受wordpress定制需求中,客户提出要在搜索列表中排除所有的页面内容的搜索结果;我们可以使用过滤器[filt…

大挖在接受wordpress定制需求中,客户提出要在搜索列表中排除所有的页面内容的搜索结果;我们可以使用过滤器[filter]来过滤掉我们不要的页面或是信息。
用户可以根据自己的需求,将下面的代码分别复制到functions.php文件中。

排除特定 ID 的文章或页面

注意修改第四行的文章或页面 ID

排除某些分类的文章

注意修改ID,看注释。

排除所有页面

来源:http://www.wazhuti.com/420.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_13021.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?