Usage of acf_render_field_setting ACF function

ACF version 5.0 introduced the field acf_render_field_setting. This allows the addition of a new field setting in the setting panel of ACF. This will display in the general field setting of every field. ACF version 6.0 introduced tabs like General, Validation, Presentation, and Conditional Logic.

You can check it out on their official blog here, about all the features they came up with in ACF 6.0.

Usage of acf_render_field_setting ACF function

The resources on the ACF site is providing enough guidance for the user on how to use the function. If you wish to add setting fields for the specific tabs then you can use the functions suggested below:

  • acf/render_field_general_settings/type={type} (for adding settings to the “General” tab)
  • acf/render_field_validation_settings/type={type} (for adding settings to the “Validation” tab)
  • acf/render_field_presentation_settings/type={type} (for adding settings to the “Presentation” tab)
  • acf/render_field_conditional_logic_settings/type={type} (for adding settings to the “Conditional Logic” tab)

Below are 2 example usage of acf_render_field_setting function:

acf_render_field_setting(
	$field,
	array(
		'label'        => __( 'Allow Other Choice', 'acf' ),
		'name'         => 'other_choice',
		'type'         => 'true_false',
		'ui'           => 1,
		'instructions' => __( "Add 'other' choice to allow for custom values", 'acf' ),
	)
);

acf_render_field_setting(
	$field,
	array(
		'label'        => __( 'Save Other Choice', 'acf' ),
		'name'         => 'save_other_choice',
		'type'         => 'true_false',
		'ui'           => 1,
		'instructions' => __( "Save 'other' values to the field's choices", 'acf' ),
		'conditions'   => array(
			'field'    => 'other_choice',
			'operator' => '==',
			'value'    => 1,
		),
	)
);

Advanced Custom Fields (ACF) is a simplest way to create custom fields. You can create custom fields for post, post types, taxonomies and users as well. ACF PRO provides a facility to create custom post types and taxonomies also.

If you are a developer then you should be aware with the use of ACF functions like get_field and the_fields. These functions are used to display the values of a custom field. Its syntax will vary based on the custom field value you are displaying for. Checkout its usage when you use it for post type, taxonomies and users.

Both the plugins ACF For Dokan PRO and ACF For WooCommerce are compatible with ACF version 6.0 and uses acf_render_field_setting function.