[wp-trac] [WordPress Trac] #48360: `meta_value` is ignored when empty string is provided
WordPress Trac
noreply at wordpress.org
Sat Oct 26 12:19:04 UTC 2019
#48360: `meta_value` is ignored when empty string is provided
--------------------------+------------------------------
Reporter: JPry | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by nofearinc):
I'd love to get this sorted (since I've dealt with this before) but here's
what the meta query class states right now:
{{{
// WP_Query sets 'meta_value' = '' by default.
if ( isset( $qv['meta_value'] ) && '' !==
$qv['meta_value'] && ( ! is_array( $qv['meta_value'] ) ||
$qv['meta_value'] ) ) {
$primary_meta_query['value'] = $qv['meta_value'];
}
}}}
I can relate with the use case and we can update the default behavior for
meta queries, and probably patch it in WP_Query so it passes null as a
default value. However, I'm not sure how robust this would be, especially
with third-party plugins relying on this core behavior.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48360#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list