How to Exclude Pages from WordPress Search Results




Add the following code in your functions.php file

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




Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.