Advertisement
Guest User

Untitled

a guest
Jun 28th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. function sw_custom_post_type_includes($query) {
  2.     if(isset($query->query_vars['post_type'])) {
  3.         if(is_search() && is_main_query() && $query->query_vars['post_type'] != 'nav_menu_item') {
  4.             $query->set('post_type', $query->query_vars['post_type']);
  5.         }
  6.     }
  7.     elseif(isset($_GET['post_type'])) {
  8.         if(is_search() && is_main_query()) {
  9.             $query->set('post_type', urldecode($_GET['post_type']));
  10.         }
  11.     }
  12. }
  13. add_filter('pre_get_posts', 'sw_custom_post_type_includes');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement