Skip to content

Instantly share code, notes, and snippets.

@blanket11
Created April 20, 2017 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blanket11/4edd9871ee69fd01039cd99ae74d9967 to your computer and use it in GitHub Desktop.
Save blanket11/4edd9871ee69fd01039cd99ae74d9967 to your computer and use it in GitHub Desktop.
[WordPress]検索結果のURLを変更
<?php
/**
* 検索結果URLの変更
* URL: ドメイン/search/?s=検索ワード
* @param $link
* @return mixed|string
*/
function custom_search_link($link) {
$link = str_replace('/search/','/search/?s=',$link);
$link = rtrim($link, '/');
return $link;
}
add_filter('search_link','custom_search_link');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment