How to exclude WordPress posts or pages from search results

This snippet will allow you to control which posts or pages there should be excluded from WordPress search results.

Instructions
Add this code to your functions.php file.
* In this snippet, posts with the IDs 0 and 1 will be excluded – edit accordingly to suit your needs.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Siteground Web Hosting

Snippet Info

Tested with Wordpress v. 4.8
Last Modified: 17.05.2017
Last Reviewed: 17.05.2017

How to exclude WordPress posts or pages from search results
4.4 (88.57%) 7 votes
Please report broken snippets.
Report Broken Snippet
Web Hosting