Created
April 20, 2017 13:52
-
-
Save blanket11/4edd9871ee69fd01039cd99ae74d9967 to your computer and use it in GitHub Desktop.
[WordPress]検索結果のURLを変更
This file contains 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 | |
/** | |
* 検索結果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