Show only “Pages” – not posts – on search page
Setting the post type at pre_get_posts can solve this. You can set it like below- function the_dramatist_search_only_page($query) { if ($query->is_search && !is_admin() ) { $query->set(‘post_type’,array(‘page’)); } return $query; } add_filter(‘pre_get_posts’,’the_dramatist_search_only_page’); Hope it helps.