Created
          September 24, 2013 14:23 
        
      - 
      
- 
        Save rupert-ong/6685554 to your computer and use it in GitHub Desktop. 
    Wordpress: Limit Search Results to Specific Post Type
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| function SearchFilter($query) { | |
| if ($query->is_search) { | |
| $query->set('post_type',array('post','page')); | |
| } | |
| return $query; | |
| } | |
| add_filter('pre_get_posts','SearchFilter'); | |
| ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment