Thanks for the question.
Just to clarify this concept. It is not possible to sort posts by a custom field value, where each custom field value has multiple values (multiple rows of data in a repeater field).
This said, it IS possible to sort the data if you only want to use the ‘first’ row from the repeater field. This means that WP has one meta_value per post and can then sort as per usual!
at the moment, your orderby meta_key query looks like this:
All you need to do is construct the exact meta_key which exists in the database. You are extremely close, but need to cahnge the wildcard (%) to 0 to target the first row:
Hope htat helps.
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!
© 2022 Advanced Custom Fields.