Support

Account

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

  • You can use either an acf/load_field or an acf/prepare_field filter. Using the former will cause a permanent change to the field when/if you edit it. Using the latter will only alter the order when an editor is using the field.

    The values of a select field are located in $field['choices'] and is an array of field value => label pairs as shown in this guide https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/

    You can use this function to short the values of the choices array https://www.php.net/manual/en/function.asort.php