分类
WordPress代码片断

WordPress把page页面从搜索结果中排除

add_filter('pre_get_posts','search_filter');
function search_filter($query) {
	if ($query->is_search) {
		$query->set('post_type', 'post');
	}
	return $query;// wodepress.org
}