Home Forums General Issues Order by true/false field using WP_Query Reply To: Order by true/false field using WP_Query

  • 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 🙂