Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#16735 closed defect (bug) (duplicate)

Querying against empty meta_value should work

Reported by: scribu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:


This should work:

      $args = array(
        'meta_query' => array(
            'key' => 'featured_image',
            'value' => '',
            'compare' => '!='
      $query = new WP_Query( $args );

Source: http://wordpress.stackexchange.com/questions/10881/how-can-i-show-posts-only-if-meta-value-is-not-empty

Change History (1)

comment:1 @dd324 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

See #16573 See #15292

Note: See TracTickets for help on using tickets.