×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Eric De Kock
Added: Apr 3, 2017 7:11 AM
Views: 11
Tags: no tags
  1. /* ==========================================================================
  2.   Search Page
  3.   ========================================================================== */
  4.  
  5. // Change the permalink for the search page
  6. function change_search_url_rewrite() {
  7.     if (is_search() && !empty($_GET['s'])) {
  8.         wp_redirect(home_url("/search/") . urlencode(get_query_var('s')));
  9.         exit();
  10.     }
  11. }
  12.  
  13. add_action('template_redirect', 'change_search_url_rewrite');
  14.