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