Home › Forums › Add-ons › Repeater Field › Sort by date a repeater field › Reply To: Sort by date a repeater field
Hi @simtwo
The acf/load_value
hook doesn’t have the field name yet, so you need to use the field key instead. Also, you need to convert the returned date to timestamp by using the strtotime()
function so you can sort it easily. Could you please try the following code?
foreach( $value as $i => $row ) {
$order[ $i ] = strtotime($row['field_1234567890abc']);
}
Where ‘field_1234567890abc’ is the field key.
I hope this 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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.