Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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.

wordpress-hacks

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

/**
 * Excluding pages from search
 */
 
function exclude_pages_from_search() {
	global $wp_post_types;
	$wp_post_types['page']->exclude_from_search = true;
}
add_action( 'init', 'exclude_pages_from_search' );

The post How to Exclude Pages From Search in WordPress appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

How to Exclude Pages From Search in WordPress

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×