How to Exclude Pages From Search in WordPress

Prem Tiwari - - WordPress, WordPress Snippets

If you are running a WordPress website and you want to exclude all pages from search, then keep your close attention in this post as I am going to share how to exclude pages from search in WordPress websites.


How to Exclude Pages From Search in WordPress

Open your functions.php file from theme’s folder and add the below code at the end of the file. If you are also using any custom post type on your website and also want to hide them, then change the post type name in this line of code. $wp_post_types['page']->exclude_from_search = true;.

About: Prem Tiwari

Prem Tiwari is the founder of and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.

Tags: , , , , , ,

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.