Last active
January 10, 2026 21:24
-
-
Save wplit/1c00b753036b44ef7762e2d83135ff97 to your computer and use it in GitHub Desktop.
Redirect WordPress search to WPGB search format
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 | |
| /** | |
| * Redirect WordPress search to WPGB search format | |
| */ | |
| add_action('template_redirect', function() { | |
| if (isset($_GET['s']) && !empty($_GET['s'])) { | |
| $search_query = sanitize_text_field($_GET['s']); | |
| $redirect_url = home_url('/search/') . '?_search_filter=' . urlencode($search_query); | |
| wp_safe_redirect($redirect_url, 301); | |
| exit; | |
| } | |
| }, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment