Created
          June 6, 2014 11:09 
        
      - 
      
- 
        Save buchin/b632e88894539a40bd9c to your computer and use it in GitHub Desktop. 
  
    
      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
    
  
  
    
  | function fb_change_search_url_rewrite() { | |
| if ( is_search() && ! empty( $_GET['s'] ) ) { | |
| $keywords = get_query_var( 's' ); | |
| list($first_word) = explode(' ', trim($keywords)); | |
| wp_redirect( home_url( $first_word ) . urlencode( $keywords ) ); | |
| exit(); | |
| } | |
| } | |
| add_action( 'template_redirect', 'fb_change_search_url_rewrite' ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment