Opened 3 years ago
Last modified 2 years ago
#15292 closed defect (bug)
It's not possible to check for "meta_value = 0" in wp_query->get_posts — at Initial Version
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | Query | Version: | 3.0.1 |
| Severity: | major | Keywords: | has-patch commit |
| Cc: |
Description
Because of the "empty" function of php it isn't possible to check for a meta_value = 0 in wp_query->get_posts.
My Case:
...
'meta_key' => '_menu_item_menu_item_parent',
'meta_value' => '0',
...
wp-includes/query.php Line 2307 is:
if ( ! empty($qmeta_value?) ) {
But empty says that String "0" is true (look here: http://ch2.php.net/empty )
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)
My solution is:
| ($qmeta_value? == '0')) { |
but that's not very nice. Any better idea?
Thanks,
Philip
Note: See
TracTickets for help on using
tickets.
