Changes between Initial Version and Version 7 of Ticket #15292
- Timestamp:
- 03/04/2011 03:45:56 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #15292
- Property Keywords 3.2-early has-patch added; query get_post meta meta_value removed
- Property Owner set to dd32
-
Property
Status
changed from
new
toaccepted
-
Property
Milestone
changed from
Awaiting Review
toFuture Release
-
Ticket #15292 – Description
initial v7 2 2 3 3 My Case: 4 ... 4 5 {{{ 5 6 'meta_key' => '_menu_item_menu_item_parent', 6 7 'meta_value' => '0', 7 ... 8 }}} 8 9 9 10 wp-includes/query.php Line 2307 is: 10 if ( ! empty($q['meta_value']) ) { 11 {{{if ( ! empty($q['meta_value']) ) {}}} 11 12 12 But empty says that String "0" is true (look here: http://ch2.php.net/empty )13 But empty() says that String "0" is true 13 14 14 15 So the query will return all posts that have a meta-field "_menu_item_menu_item_parent" and not only the posts with "_menu_item_menu_item_parent = 0" (which means, that it's an menu root item) 15 16 16 17 My solution is: 18 19 {{{ 17 20 if (( ! empty($q['meta_value']) ) || ($q['meta_value'] == '0')) { 21 }}} 18 22 19 23 but that's not very nice. Any better idea?