NO BUG: Query Loop order by meta_value blanks data when ACF Pro meta key is entered

Using Bricks 2.0.1

Watched the tutorial by Paul Feig: https://www.youtube.com/watch?v=RPFylqdqPZI and wanted to use his solution to sort an Events calendar I’m creating.

Set Query to Posts; Post type to Event; Order by to meta_value, and pasted in single_date from my ACF field. In the builder, all events except the first disappear. On the front end, all events disappear.

Also, when I go to clear/edit the Order meta key field, the Query Loop closes and I have to open it again.

When I do manage to clear the field, the entries come back in the builder and on the front end, even though meta_value is still listed in the Order by field.

I suppose I could use a PHP solution generated by ChatGPT, but I hate extra PHP code if a more elegant and simple solution is available.

I can provide a login, if needed.

Hi Harry,
Thanks so much for your report!

Unfortunately, I cannot reproduce the problem. Please send temporary login credentials and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase.

Best regards,
timmse

Thanks for the login credentials!

The date fields are in an ACF group field, so the meta key is not single_date, but date_single_date.

date is the group, single_date the field.

Thanks for clarifying the issue. Might want to put that in the updated Bricks Academy.

Hi there,

As the meta field key is decided by the custom field plugin (ACF), you should check their documentation area.

This is an example topic Get meta_key from a field inside a group - ACF Support

Thanks.

Regards,
Jenn

Serves me right for not checking there first - but in my defense, ACF’s documentation is obscure for mid-level nerds like me. If you don’t know exactly what you’re looking for, it’s hard to find. And a lot of times it requires PHP coding skills I do not possess. Thankfully, ChatGPT is helpful in that regard.

In this case, I didn’t realize that being inside a group meant I had to add that to the meta key. So I wouldn’t have known what to search for there.

In this case, a look at the database will help. Custom fields are saved in wp_postmeta. In your case, you would see that single_date does not exist, but date_single_date does.

In general, it is advisable to take a look at the database, especially when it comes to date comparisons and the like - it depends specifically on how the data is stored, otherwise you are comparing apples with oranges (date format a with date format b , which can’t work).