Last active
February 1, 2016 09:11
-
-
Save mariokerkhof/6ab4684de2da731929a9 to your computer and use it in GitHub Desktop.
ACF Repeater Sort by Field in Dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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