#42397 closed defect (bug) (worksforme)
% symbol don't work anymore in args of wp_query
Reported by: | pactivis132 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8.3 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
Hello,
Yesterday, after the update 4.8.3 of Wordpress, in the argument for wp_query, the % symbol don't work anymore. Actually, it is when we try to push this type of structure : 'meta_key' => 'deadlines_%_date', it don't work. It generate an error.
Change History (4)
#3
@
7 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
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.
Hey @pactivis132! Welcome to Trac :D
I'm trying to reproduce the problem, but I couldn't. Can you provide more information on how you are using '%' before 4.8.3?
Actually, I created a 4.7.7 install and two new posts with "teste" meta_key and differente values.
This query shows both:
But this don't show nothing:
Not even with LIKE compare:
(Same behaviour trying '%' in meta_value - LIKE compare is for them after all - and trying both tests in 4.8.3 version)
Sorry if I misunderstood your point.