Home Forums General Issues bug? checkbox fields in custom queries


bug? checkbox fields in custom queries

  • I know this has been asked before – but I’m still puzzled since it seems that some prople managed to get this working while others not.

    As the title suggests I need to run a query filtered by conditions set in checkboxes. I now have a unique checkbox for this CPT and I also switched to the true/false checkbox – but nothing helps. My query looks like this:

    $plays = get_posts(array(
    	'post_type' => 'performance',
    	'meta_key'	=> 'the_date',
    	'orderby'	=> 'meta_value_num',
    	'order'     => 'ASC',
    	'posts_per_page'	=> -1,
    	'meta_query'     => array(
    	  'relation' => 'AND',
    		  'key'        => 'the_date',
    		  'compare'    => '>=',
    		  'value'      => $today,
    		  'relation' => 'OR',
    				'key' => 'hide_performance',
    				'value' => '1',
    				'compare' => 'NOT EXISTS',
    				'key' => 'hide_performance',
    				'value' => '1',
    				'compare' => '!=',

    the strange thing is, I don’t seem to get anything from the checkbox – even if I just want to output the value like

    echo ( get_field('auffuhrung_verstecken') );

    or like this:

    print_r ( get_field('auffuhrung_verstecken') );

    I have both the latest installations for WP (4.9.1) and ACF (5.6.7)

    thank you very much
    kind regards

  • I solved it – turned out the CPT was ‘corrupt’ and didn’t accept any news fields. On the backend everything looked ok, but i couldn’t get any data from whatever new field. So I added a new almost identical CPT, moved everything over and – voilà – it worked.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘bug? checkbox fields in custom queries’ is closed to new replies.