Home › Forums › ACF PRO › Repeater reverse order in admin area › Reply To: Repeater reverse order in admin area
So,,, this was quite easy once I turned on my brain.
The instructions were on the website all a long :-))
function my_acf_load_value( $value, $post_id, $field ) {
$order = array();
if( empty($value) ) {
return $value;
}
// populate order
// Remember to change the field_5a4d0e70a5d3f to the field that you want to sort by
foreach( $value as $i => $row ) {
$order[ $i ] = $row['field_5a4d0e70a5d3f'];
}
array_multisort( $order, SORT_DESC, $value );
return $value;
}
// Remember to change "book_repeater" to your repeater field name
add_filter('acf/load_value/name=book_repeater', 'my_acf_load_value', 10, 3);
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.