Support

Account

Forum Replies Created

  • Hi @elliot and thanks for your information.

    I investigated and here are the results. They may be useful to a future person that has the same issue, or maybe to enhance ACF a bit.

    I switched the field type from True/False to Radio, where I was able to provide two text values ‘yes’ / ‘no’ and defined ‘no’ to be the default value.

    However, the WP_Query still only returned the same, and then it hit me. The problem was not what I thought. Actually, I had already 250 articles, and when adding a new custom field through ACF, unless each article is manually edited and updated, the custom field is not listed at all in the meta data of that article. This does not depend on the actal value or default value of the field.

    So, what would be a nice to have feature is that when adding a new field, having a button or some action link that would allow to set the default value for this new custom field, on all items using this field set, and which have no value for that field at all. Also, adding a little note about this behaviour into the documentation on the queries would help the newbie user to realize how it works.

    Thanks 🙂

  • Hi @elliot and thanks for the quick reply.

    Does this mean that it is impossible to order by a true/false ACF field at all, when using WP_Query ?

    When the checkbox for that field is unchecked, does ACF save 0 or a NULL into the database ?

    Is there a way to define a default value so there are no NULLs in database ?

    I’m quite surprised because when you run a query against a table and order by a field, even records with NULL are ordered as expected..

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