#42426 closed defect (bug) (invalid)
Search by keyword in non-English language site doesn't work
Reported by: | PT Guy | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8.3 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
# The Query
$the_query = new WP_Query( array( 's' => 'Лорем', ) );
# Result
No posts found.
# Reason
The executed query $the_query->request included placeholder strings:
wp_posts.post_title LIKE '{290b944af99425682ef70000028625991093545a19c3cd2ccbf53c91848c62a7}Лорем{290b944af99425682ef70000028625991093545a19c3cd2ccbf53c91848c62a7}'
which were added in parse_search() by $wpdb->prepare(), but were not removed before execution.
# Solution
global $wpdb; add_filter( 'posts_request', array( $wpdb, 'remove_placeholder_escape' ), 10, 2 );
Change History (4)
Note: See
TracTickets for help on using
tickets.
For the record,
$the_query->request
does indeed contain escaped placeholders, but the resulting query appears to be correct and works as expected in my testing.