I get posts by first letter this way:
$results = $wpdb->get_results(
"
SELECT * FROM $wpdb->posts
WHERE post_title LIKE '$request%'
AND post_type = 'post'
AND post_status = 'publish'
ORDER BY post_title ASC;
"
);
And I have a problem. If I want to get posts that starts from Ą letter, wordpress gives me posts that starts from A, if Š gives S etc. How can I get posts with strict letter start?
You're most likely using a "Accent Insensitive" database collation. Depending on your exact server set up, you're probably using utf8mb4_unicode_ci
or latin1_swedish_ci
. You'll most likely need to change that to utf8_YOURREGION_ci
or just utf8mb4_bin
.
The easiest way to change the DB Collation is directly in phpMyAdmin if you have access to it.