Is it possible and how can you make it so that the search finds results with words in which there are Latin letters such as for example čėšū, but despite the fact that in the search field a person would not necessarily use them? That is, for example, there is a post in which there is a required word "maša", but at the moment this post only finds me if I write "maša", and I want to find it when searching for "masa". In general, the letters čėšū were perceived as cesu.

  • Use transliteration in your search. - ilyaplot
  • I couldn’t get WP to NOT find words with accents : take.ms/jQWz4 - KAGG Design
  • If you use the standard search template without additional parameters. then really looking and finding how I want. but if I use 's' => $ _GET ['s'], then I don’t find it. - akasergej

1 answer 1

It looks like it's in the COLLATE database tables. There is a recipe. Try pasting the code below into functions.php. It filters the search query by post and adds COLLATE utf8_unicode_ci .

 add_filter('posts_search_orderby', 'alter_query', 20, 2); function alter_query($orderby, $query) { return $orderby . ' COLLATE utf8_unicode_ci'; } 
  • with this code does not find anything at all :( - akasergej
  • and in the database which collate is specified? - KAGG Design
  • If you use the standard search template without additional parameters. then really looking and finding how I want. but if I use 's' => $ _GET ['s'], then I don’t find it. - akasergej
  • and this was not raised in the question))) - KAGG Design
  • It was you who suggested me when they said that it works for you. Then I threw a standard file and really began to find. But I miss the standard. It is necessary to transfer additional parameters: (utf8mb4_unicode_ci - akasergej