Im really happy with your plugin. It saves me loads of work
I have added a true/false field to a post. From a custom loop i want to exclude every post that has that option checked (meaning true).
I have been trying for hours but i cant get it to work. I tried this code:
<?php query_posts( array( 'showposts' => 10, 'meta_query' => array( array( 'key' => 'xv_agenda', 'value' => '1', 'compare' => '!=' ) ) ) );?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?>
What am i doing wrong?
The field name is xv_agenda, and when the checkbox is checked i want to exclude it from my loop. Can you guys help me with this?
Thanks in advance!
Hi I had the exact same issue, and I know the original post was a couple months ago, but for future voyagers…
The solution for me turned out to be the issue with adding new custom fields to existing posts. The posts need to be updated, even if the custom field value is unchanged from the default.
I am in a similar situation. I have added a true/false checkbox to existing fields and it doesn’t recognize an unchecked value as 0. When I echo the value of a checked box I get 1 and an unchecked box returns nothing. I have tried the bulk update posts to try to get the database to recognize this new fields and record a 0 but it doesn’t seem to work.
I have been working through this on another post
but I have not had any success. I know the code makes sense but the results don’t display.
I’d love to know what you did to resolve this issue.
The topic ‘Meta_compare with true/false field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!