0

WP search automatically replaces lithuanian characters to standart (ą => a, č => c, ę = > e). How to disable this auto replacing?

For example: when I type "č" in search field, I also get results with "c" like "Asus Acer".

1 Answer 1

1

Try to change collation with the following code in functions.php

add_filter( 'posts_search_orderby', 'alter_query', 20, 2 );
function alter_query( $orderby, $query ) {
    return $orderby . ' COLLATE latin1_general_ci';
}
3
  • Thank you for the answer. Are you about wp-includes/functions.php? Feb 20, 2018 at 21:54
  • 1
    No! Never touch the core. I mean functions.php of your theme. Feb 20, 2018 at 22:06
  • Hmm, I just added your code at the end of themes/design/functions.php, but nothing happens :( Feb 20, 2018 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.