[wp-trac] [WordPress Trac] #25538: WP_Query: OR relation breaks orderby meta_value
WordPress Trac
noreply at wordpress.org
Thu Mar 27 04:54:03 UTC 2014
#25538: WP_Query: OR relation breaks orderby meta_value
--------------------------+------------------
Reporter: darrengrant | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.9
Component: Query | Version:
Severity: major | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------
Comment (by jackreichert):
phpunit is pretty awesome. Wish I new about it when I first wrote the
ticket.
So here's what happened. The JOINs were being dropped because on line 825
the method was checking to see if $where[k] was empty, but I did not
update that to check $where_meta_key as well.
The second problem was more fundamental to the patch itself (lines
817-821) -- If you have a meta_query with a compare, the AND should not be
included inside the OR condition otherwise the condition will always be
true (see above).
But the test that was failing (/tests/phpunit/tests/post/query.php:46),
was failing because that query is designed to be structured as the method
intended it to be.
I think for a future release, or for documentation, I'll take a crack at
parsing out that method and annotating the heck out of it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25538#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list