Posted By

florent on 10/21/11


Tagged

search wordpress


Versions (?)

Limit Search Results to Specific Post Types


 / Published in: PHP
 

  1. function SearchFilter($query) {
  2. if ($query->is_search) {
  3. $query->set('post_type',array('post','page'));
  4. }
  5. return $query;
  6. }
  7. add_filter('pre_get_posts','SearchFilter');

Report this snippet  

You need to login to post a comment.