[wp-trac] [WordPress Trac] #42471: In wp_query, the function parse_search need a remove_placeholder_escape()

WordPress Trac noreply at wordpress.org
Mon Nov 13 02:23:41 UTC 2017


#42471: In wp_query, the function parse_search need a remove_placeholder_escape()
-------------------------------+------------------------------
 Reporter:  w.sung             |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Database           |     Version:  4.8.3
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by dd32):

 * keywords:   => reporter-feedback
 * component:  Query => Database
 * severity:  major => normal


Comment:

 Hi @w.sung and welcome to Trac.

 The change here is expected, and should work properly as-is.
 When the `$search` value is passed to `$wpdb->query()` the filters there
 will correct remove the placeholders and perform the expected query
 against the database.
 For reference, here's where the filter is added and used:
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-
 db.php?marks=1789,1959#L1750 (Line 1789 = where the filter is run, 1959 =
 where the filter is added)

 Can you explain what the actual issue you're encountering is?

 FWIW, this returns the expected 10 for me: {{{var_dump( (new WP_Query([
 's' => 'testing' ]))->post_count );}}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42471#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list