Advanced Settings

Manage fields settings from the field’s UI. Settings can be set depending on the current screen location. In order to enable the Advanced Settings UI, you must enable the Field Group: Advanced Settings feature.

  • Order
  • Label
  • Name
  • Key
  • Type

Change field settings based on location

1
1
2
1
+
1
1
+

Available Locations

Choose the location screen where the settings should be applied. You can set multiple settings groups based on different locations.

Everywhere
Administration
Front-end

Available Settings

The UI comes with predefined settings that can be used out of the box.

Setting nameExpected Value
RequiredTrue/False
Hide fieldTrue/False
Hide labelTrue/False
Default valueText
PlaceholderText
InstructionsText
Custom settingTrue/False/Text

Custom Setting

Using the “Custom setting” option, you can set any valid field settings. Settings names can be found using acf_get_field(). Usage example:

$select = acf_get_field('my_select_field'); // Using name
$select = acf_get_field('field_5f35690c1da04'); // Using key

/*
 * Array
 * (
 * ...
 * [placeholder] =>
 * [instructions] => Vivamus magna justo, lacinia eget.
 * [required] => 0
 * [conditional_logic] => 0
 * [wrapper] => Array
 *      (
 *          [width] =>
 *          [class] =>
 *          [id] =>
 *      )
 * [choices] => Array
 *      (
 *          [choice_1] => Choice 1
 *          [choice_2] => Choice 2
 *          [choice_3] => Choice 3
 *          [choice_4] => Choice 4
 *      )
 * [default_value] =>
 * [allow_null] => 0
 * [multiple] => 0
 * [ui] => 0
 * [ajax] => 0
 * [return_format] => value
 * ...
 * )
 */

In this example, the Select field has the following settings: allow_null, multiple, ui, ajax, return_format etc…

Set Settings in PHP

It is possible to alter field settings based on the screen location programmatically using the acfe/load_field hook combined with acfe_is_admin() and acfe_is_front() functions.

Note that this method doesn’t require to enable the “Advanced Settings” in the field group as it is directly executed in PHP. Usage example:

add_filter('acfe/load_field/name=my_field', 'my_acfe_load_my_field');
function my_acfe_load_my_field($field){
    
    // Admin only
    if(acfe_is_admin()){
        
        $field['required'] = true;
    
    }
    
    // Front-end only
    if(acfe_is_front()){
    
        $field['multiple'] = true;
    
    }
    
    // return
    return $field;
    
}