Support

Account

Home Forums Add-ons Repeater Field Sort by date a repeater field Reply To: Sort by date a repeater field

  • Hey @James, thank you for your help.
    So I did try the following code you send me, it doesn’t seem to work yet.

    Here is what I wrote on my functions.php

    <? function my_acf_load_value( $value, $post_id, $field ) {
    
        $order = array();
        
    
        if( empty($value) ) {
            
            return $value;
            
        }
    
        foreach( $value as $i => $row ) {
            
        $order[ $i ] = strtotime($row['date']);
            
    }
    
        array_multisort( $order, SORT_DESC, $value );
      
        return $value;
        
    }?>
    
    <? add_filter('acf/load_value/name=date', 'my_acf_load_value', 10, 3);?>