Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Show post if true/false is no ACF

How to display only posts, what have field "nezobrazovat" as false?

This is my code:

        $args = array(
            'posts_per_page' => 3,
            'post_type' => 'mycustompost',
            'key'=> 'nezobrazovat',
            'value'=>'no',
        );

This doesnt work, all first 3 posts are displayed

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

From the acf docs the value is 1 or 0

$posts = get_posts( array(
    'meta_query' => array(
        array(
            'key'   => 'show_in_sidebar',
            'value' => '1',
        )
    )
) );

https://www.advancedcustomfields.com/resources/true-false/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading