Sanitize the term slugs before query them for non ASCII characters slugs case #2948
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
If there's a taxonomy terms that have a non ASCII characters and we are trying to filter the posts or getting the term info by this term slug the Elasticsearch will return nothing because the non ASCII slugs are saved in the WordPress and Elasticsearch as following:
In WordPress database:
In Elasticsearch:
So comparing via slug without sanitizing will be wrong.
Closes #
How to test the Change
If trying to filter the posts list in the admin dashboard via a term that has a non ASCII characters in its slug will got empty result even if there's posts linked with this term, this is an example url:
www.example.com/wp-admin/edit.php?category_name=غير-مصنف
Changelog Entry
Credits
Checklist: