Support

Account

Home Forums General Issues Sort ASC a select field in backend Reply To: Sort ASC a select field in backend

  • Hello John,

    Thank you for your help.

    For those facing this problem, here is my code:

    function my_acf_prepare_field( $field ) {
    
    $choices = $field['choices'];
    asort($choices, SORT_NATURAL);
    $field['choices'] = $choices;
    
        return $field;
    }
    
    // Apply to fields named "example_field".
    add_filter('acf/prepare_field/name=your_field', 'my_acf_prepare_field');