Changes between Initial Version and Version 1 of Ticket #23268, comment 22
- Timestamp:
- 02/06/2015 07:47:32 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #23268, comment 22
initial v1 1 one more weirdness 2 this works 3 {{{ 4 $query['meta_query'] = array( 5 6 7 'relation' => 'OR', 8 array( 9 'key' => 'app_exclude', 10 'compare' => 'NOT EXISTS' 11 'value' => 'completely' 12 ), 13 array( 14 'key' => 'app_exclude', 15 'compare' => '!=', 16 'value' => '1' 17 ), 18 ); 19 }}} 20 21 this doesn't 1 the problem persists in WP.4.1 22 2 23 3 {{{ 24 $query['meta_query'] = array( 25 'relation' => 'OR', 26 array( 27 'key' => 'app_exclude', 28 'compare' => '!=', 29 'value' => '1' 30 ), 31 array( 32 'key' => 'app_exclude', 33 'compare' => 'NOT EXISTS' 34 'value' => 'completely' 35 ), 36 37 ); 4 $args = array( 5 'post_type' => $page_type, 6 'posts_per_page' => -1, 7 'author' => $user_ID, 8 'post_status' => array('publish', 'draft'), 9 'relation' => 'OR', 10 'meta_query' => array( 11 array( 12 'key' => 'event_boolean', 13 'compare' => 'NOT EXISTS', 14 'value' => 'completely' 15 ), 16 array( 17 'key' => 'event_boolean', 18 'compare' => '!=', 19 'value' => '1' 20 ), 21 ) 22 ); 38 23 }}} 39 24 40 25 41 NOT EXISTS has to be defined on first place, or you won't get the result 42 (WP 4.1) 26 one or the other meta comparison returns result, but when I use both no result is returned at all. 27 Truth is that that the value for "NON EXISTS" is not needed but pairing the meta arrays cancel out the functionality. 28 (in my case I have one post with "event_boolean" empty, and the other with 0, so this should return 2 posts but none is returned)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)