Support

Account

Home Forums General Issues Meta query for image field issue Reply To: Meta query for image field issue

  • Try this

    
    $wp_query = new WP_Query( array(
    	'post_type'      => 'post',
    	'posts_per_page' => -1,
    	'meta_key' => 'delight_image',
    	'meta_query' => array(
    		'relation' => 'AND',
    		array(
    			'key' => 'delight_image',
    			'compare' => 'EXISTS',
    		),
    		array(
    			'key' => 'delight_image',
    			'value' => array(''),
    			'compare' => 'NOT IN',
    		),
    	),
    
    ) );
    

    It’s from something I found here http://wordpress.stackexchange.com/questions/10881/how-can-i-show-posts-only-if-meta-value-is-not-empty