How to Exclude Pages From Search in WordPress

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;.

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:

Article Tags: , , , , , ,