法提赫,
使用str\\u replace处理土耳其字符问题。像这样更改代码;
/*
Plugin Name: Redirect Search Results
Author: Abdussamad
Plugin URI: http://wordpress.stackexchange.com/questions/70740/search-url-wp-rewrite-after-redirect
*/
class redirect_search_results {
function __construct() {
add_action( \'init\', array( $this, \'redirect\' ) );
}
function redirect() {
if( isset( $_GET[ \'s\' ] ) ) {
$turkish= array("İ","ı","Ü","ü","Ö","ö","ğ","Ğ","ş","Ş");
$nturkish = array("i","i","U","u","O","o","g","Ğ","s","S");
$quest = str_replace($turkish,$nturkish,$_GET[\'s\']);
wp_redirect( home_url( \'/icerik/\' . $quest . \'.html\' ), 301 );
exit;
}
}
}
new redirect_search_results();