Posted By

zealmurapa on 04/19/11


Tagged

search only posts


Versions (?)

Search Posts Only


 / Published in: PHP
 

  1. // Search Post only not Pages
  2. function vibeExcludePages($query) {
  3. if ($query->is_search) {
  4. $query->set('post_type', 'post');
  5. }
  6. return $query;
  7. }
  8. add_filter('pre_get_posts','vibeExcludePages');
  9. ; ?>

Report this snippet  

You need to login to post a comment.