[wp-trac] [WordPress Trac] #42400: WP_User_Query is broken in 4.8.3

WordPress Trac noreply at wordpress.org
Wed Nov 1 22:34:41 UTC 2017


#42400: WP_User_Query is broken in 4.8.3
--------------------------+----------------------
 Reporter:  amityweb      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:  4.8.3
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by Otto42):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 All queries in WordPress will be affected by this.

 WordPress core does not support, and has never supported, meta_key's that
 contain wildcards because WordPress always uses an = comparison for the
 meta_key, never a LIKE comparison.

 It is true that some users use plugins or other custom code to convert
 that = into a LIKE for those % cases. The change to the way queries work
 in 4.8.3 will probably break that existing code. This cannot be avoided.
 The plugin or custom code will need to be changed to accommodate this.

 Note that plugins or custom code that uses the "query" filter can see the
 full SQL string, as it will run, without the new changes in 4.8.3. This
 will include the percent signs as previously. Code that uses this filter
 will be unaffected and continue to work correctly. Code that used other
 filters will not see % signs in their filter input any longer, and should
 be modified to not be looking for the % sign specifically.

 In other words, whatever special you have that originally made this:

 `'key' => 'subject_specialism_%_subject',`

 become this:

 `wp_usermeta.meta_key LIKE 'subject_specialism_%_subject'`

 Won't work anymore, because WordPress does not store that % in the string
 any longer. You have some code somewhere that looks for that percent and
 changes the = into a LIKE. WordPress has no code that will put a LIKE onto
 a meta_key like that. So, you have something custom, some plugin, or some
 custom function, that does that. That is what needs to be repaired.

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


More information about the wp-trac mailing list