How to Exclude Custom Post Type From Search

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.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , , ,