How to Exclude Custom Post Type From Search

Prem Tiwari - - WordPress Snippets

This is very helpful code snippets to exclude the custom posts from WordPress search algorithm. If you are using custom post types on your WordPress sites and don’t want to display that post in your search results, then use the below code.

Exclude a custom post type from search

Copy the below code and add at the end of the functions.php file.

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.