Support

Account

Home Forums ACF PRO True/False – No Value for False Reply To: True/False – No Value for False

  • I know I’m bit late for the party but I think this might be useful to someone. The return value change based on the method you use.

    If you use get_posts() then it will return null for false values. If you use WP_Query() you’ll get true if checked and false if not checked.

    So here is what worked for me. for get_posts()

      'meta_query'  => array(
    	          array(
    	            'key'       => 'archived_post',
    	             'value'     => '1',
    	             'compare'   => 'NOT EXISTS'
    	             ),)

    For WP_Query()

    'meta_query'  => array(
    	        array(
    	        'key'       => 'archived_post',
    	         'value'     => '1',
    	         'compare'   => '!='
    	         ),)

    Cheers
    Amila