Documentation

Getting Started

Advanced Custom Fields is a WordPress plugin which allows you to add extra content fields to your WordPress edit screens. These extra content fields are more commonly referred to as Custom Fields and can allow you to build website’s faster and educate your client’s quicker.

Functions

ACF boasts a simple to use and powerful API. Checkout the available functions to power your website.

Basic
get_field()
get_field($selector, [$post_id], [$format_value]);
Returns the value of a specific field
the_field()
the_field($selector, [$post_id], [$format_value]);
Displays the value of a specific field
get_field_object()
get_field_object($selector, [$post_id], [$format_value], [$load_value]);
Returns the settings (array) of a specific field
get_fields()
get_fields([$post_id]);
Returns an array of values (name => value) for a specific post
get_field_objects()
$fields = get_field_objects([$post_id]);
Returns an array of field settings (name => field) for a specific post
Loop
have_rows()
have_rows($field_name, [$post_id]);
This function is used to loop over a repeater or flexible content field's value
get_sub_field()
get_sub_field($sub_field_name, [$format_value]);
Returns the value of a specific sub field.
the_sub_field()
the_sub_field($sub_field_name, [$format_value]);
Displays the value of a specific sub field.
get_sub_field_object()
get_sub_field_object($sub_field_name, [$format_value]);
Returns an array of field data (field object + value) for a specific sub field.
get_row()
get_row( [$format_values] );
Return an array containing all sub field values for the current row.
get_row_index()
get_row_index();
Returns the current row index within a have_rows() loop
get_row_layout()
get_row_layout();
Returns the current row layout name within a have_rows() loop
Update
delete_sub_field()
update_field()
update_field($selector, $value, [$post_id]);
Updates a field value.
delete_field()
delete_field($selector, [$post_id]);
Deletes a field value.
update_sub_field()
update_sub_field( $selector, $value, [$post_id] );
Updates a sub field value.
add_row()
add_row( $selector, $value, [$post_id] );
Adds a new row of data to an existing repeater / flexible content field value.
update_row()
update_row( $selector, $row, $value, [$post_id] );
Updates a row of data for an existing repeater / flexible content field value.
delete_row()
delete_row( $selector, $row, [$post_id] );
Deletes a row of data from an existing repeater / flexible content field value.
add_sub_row()
add_sub_row( $selector, $row, [$post_id] );
Adds a row of data for an existing repeater / flexible content sub field value.
update_sub_row()
update_sub_row( $selector, $i, $row, [$post_id] );
Updates a row of data for an existing repeater / flexible content sub field value.
delete_sub_row()
delete_sub_row( $selector, $i, [$post_id] );
Deletes a row of data from an existing repeater / flexible content sub field value.
Other
acf_add_options_page()
acf_add_options_page( $args );
Add a global options page to the WP dashboard
acf_add_options_sub_page()
acf_add_options_sub_page($page);
Add a global options sub page to the WP dashboard
acf_form_head()
acf_form_head();
Validates and saves data submitted from an acf_form().
acf_form()
acf_form( $options );
Creates a front end form.
acf_register_form()
acf_register_form( $settings );
Registers a front end form.
Shortcode
[acf field="field_name"]
Used withing a content editor to display a custom field’s value
Deprecated
acf_set_options_page_capability()
acf_set_options_page_menu()
acf_set_options_page_title()
has_sub_field()
the_flexible_field()
the_repeater_field()

Actions

Hook into these actions to customize your ACF experience.

acf/field_group/admin_enqueue_scripts
Called during the enqueue_scripts action when editing a field group.
acf/field_group/admin_head
Called during the admin_head action when editing a field group
acf/init
Called after ACF is finished loading and is similar to the WordPress init action.
acf/input/admin_enqueue_scripts
Called during the enqueue_scripts action when editing a post.
acf/input/admin_footer
Called during the admin_footer action when editing a post.
acf/input/admin_head
Called during the admin_head action when editing a post.
acf/input/form_data
Called during the
element when editing a post.
acf/render_field
acf/render_field
acf/render_field/type={$field_type}
Called when rendering a field input
acf/save_post
Called when saving $_POST data
acf/validate_save_post
Called when validating $_POST data.
Deprecated
acf_head-fields
acf_head-input
acf_print_scripts-input
acf_print_styles-input
acf_save_post

Filters

Hook into these actions to customize your ACF experience.

acf/compatibility
acf/compatibility/{$name}
Enable specific backwards compatibility logic
acf/fields/flexible_content/layout_title
acf/fields/flexible_content/layout_title
acf/fields/flexible_content/layout_title/name={$name}
acf/fields/flexible_content/layout_title/key={$key}
Customize the text (HTML) displayed at the top of each flexible content layout
acf/fields/google_map/api
Customize the URL parameters used to load Google Maps JS
acf/fields/post_object/query
acf/fields/post_object/query
acf/fields/post_object/query/name={$name}
acf/fields/post_object/query/key={$key}
Customize the $args array used to query posts for the post object field
acf/fields/post_object/result
acf/fields/post_object/result
acf/fields/post_object/result/name={$name}
acf/fields/post_object/result/key={$key}
Customize the result (text) displayed for each option in the post object field
acf/fields/relationship/query
acf/fields/relationship/query
acf/fields/relationship/query/name={$name}
acf/fields/relationship/query/key={$key}
Customize the $args array used to query posts for the relationship field
acf/fields/relationship/result
acf/fields/relationship/result
acf/fields/relationship/result/name={$name}
acf/fields/relationship/result/key={$key}
Customize the result (text) displayed for each option in the relationship field
acf/fields/taxonomy/query
acf/fields/taxonomy/query
acf/fields/taxonomy/query/name={$name}
acf/fields/taxonomy/query/key={$key}
Customize the $args array used to query terms for the taxonomy field (select display)
acf/fields/taxonomy/wp_list_categories
acf/fields/taxonomy/wp_list_categories
acf/fields/taxonomy/wp_list_categories/name={$name}
acf/fields/taxonomy/wp_list_categories/key={$key}
Customize the $args array used to query and list terms for the taxonomy field (checkbox and radio display)
acf/format_value
acf/format_value
acf/format_value/type={$type}
acf/format_value/name={$name}
acf/format_value/key={$key}
Customize the value when it is called from a template function such as get_field()
acf/load_field
acf/load_field
acf/load_field/type={$type}
acf/load_field/name={$name}
acf/load_field/key={$key}
Customize the field when it is loaded
acf/load_value
acf/load_value
acf/load_value/type={$type}
acf/load_value/name={$name}
acf/load_value/key={$key}
Customize the value when it is loaded
acf/pre_save_post
Customize the $post_id used to save data during the acf_form_head() function
acf/prepare_field
acf/prepare_field
acf/prepare_field/type={$type}
acf/prepare_field/name={$name}
acf/prepare_field/key={$key}
Customize the field after its value is loaded (before field is rendered for input)
acf/settings
acf/settings/name={$name}
Customize ACF settings which are used throughout the plugin
acf/update_value
acf/update_value
acf/update_value/type={$type}
acf/update_value/name={$name}
acf/update_value/key={$key}
Customize the value before it is saved
acf/upload_prefilter
acf/upload_prefilter
acf/upload_prefilter/type={$type}
acf/upload_prefilter/name={$name}
acf/upload_prefilter/key={$key}
Perform custom validation on an attachment before it is uploaded
acf/validate_attachment
acf/validate_attachment
acf/validate_attachment/type={$type}
acf/validate_attachment/name={$name}
acf/validate_attachment/key={$key}
Perform custom validation on an attachment before it is uploaded or selected
acf/validate_value
acf/validate_value
acf/validate_value/type={$type}
acf/validate_value/name={$name}
acf/validate_value/key={$key}
Perform custom validation on a field's value before it is saved
Deprecated
acf_load_field
acf_load_value
acf_update_value
acf/options_page/settings

FAQ

Frequently Asked Questions.

Have a different question?

Submit a ticket to our friendly support team and let us help solve your issue.

Open a new support ticket