Skip to content

Instantly share code, notes, and snippets.

@mariokerkhof
Last active February 1, 2016 09:11
Show Gist options
  • Save mariokerkhof/6ab4684de2da731929a9 to your computer and use it in GitHub Desktop.
Save mariokerkhof/6ab4684de2da731929a9 to your computer and use it in GitHub Desktop.
ACF Repeater Sort by Field in Dashboard
function mkr_acf_repeater_sort_dashboard( $value, $post_id, $field ) {
$order = array();
if( empty($value) ) {
return $value;
}
// Order
foreach( $value as $i => $row ) {
$order[ $i ] = $row['field_56a9c7a5158cb']; // field_56a9c7a5158cb
}
// multisort
array_multisort( $order, SORT_ASC, $value );
// return
return $value;
}
add_filter('acf/load_value/name=Stand', 'mkr_acf_repeater_sort_dashboard', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment