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() Returns the value of a specific field.
get_field_object() Returns the settings of a specific field.
get_field_objects() Returns the settings of all fields saved on a specific post.
get_fields() Returns an array of field values (name => value) for a specific post.
the_field() Displays the value of a specific field.
Loop
get_row() Returns an array containing all values for the current row.
get_row_index() Returns the current row index within a have_rows() loop
get_row_layout() Returns the current row layout name within a have_rows() loop
get_sub_field() Returns the value of a specific sub field.
get_sub_field_object() Returns the settings of a specific sub field.
have_rows() Used to loop through a parent field's value.
the_sub_field() Displays the value of a specific sub field.
Update
add_row() Adds a new row of data to an existing Repeater or Flexible Content field value.
add_sub_row() Adds a new row of data to a Repeater or Flexible Content sub field value.
delete_field() Deletes the value of a specific field.
delete_row() Deletes a row of data from an existing Repeater or Flexible Content field value.
delete_sub_field() Deletes the value of a specific sub field.
delete_sub_row() Deletes a row of data from an existing Repeater or Flexible Content sub field value.
update_field() Updates the value of a specific field.
update_row() Updates a row of data for an existing Repeater or Flexible Content field value.
update_sub_field() Updates the value of a specific sub field.
update_sub_row() Updates a row of data for an existing Repeater or Flexible Content sub field value.
Other
acf_add_options_page() Adds an options page to the admin menu.
acf_add_options_sub_page() Add a global options sub page to the WordPress dashboard.
acf_form() Creates a front end form.
acf_form_head() Validates and saves data submitted from an acf_form().
acf_register_block_type() Registers a custom block type in the Gutenberg editor.
acf_register_form() Registers a front end form.
Shortcode Used within a content editor to display a custom field’s value
Deprecated
acf_set_options_page_capability() Modifies the default Options Page capability setting.
acf_set_options_page_menu() Modifies the default Options Page menu name setting.
acf_set_options_page_title() Modifies the default Options Page title setting.
has_sub_field() Loops through rows of a repeater or flexible content field
the_flexible_field() Loops through rows of a flexible content field
the_repeater_field() Loops through rows of a Repeater field.

Actions

Hook into these actions to customize your ACF experience.

acf/field_group/admin_enqueue_scripts Fires during the "enqueue_scripts" action when editing a field group.
acf/field_group/admin_footer Fires during the "admin_footer" action when editing a field group.
acf/field_group/admin_head Fires during the "admin_head" action when editing a field group.
acf/init Fires after ACF is fully initialized.
acf/input/admin_enqueue_scripts Fires during the "enqueue_scripts" action when editing a post.
acf/input/admin_footer Fires during the "admin_footer" action when editing a post.
acf/input/admin_head Fires during the "admin_head" action when editing a post.
acf/input/form_data Fires after ACF generates the hidden inputs required for each form.
acf/render_field Fires when rendering a field.
acf/save_post Fires when saving $_POST data.
acf/validate_save_post Fires when validating `$_POST` data.

Filters

Hook into these actions to customize your ACF experience.

acf/compatibility Used to enable backwards compatibility support.
acf/fields/flexible_content/layout_title Filters the $title HTML for each Flexible Content layout.
acf/fields/google_map/api Filters the url parameters used to load the Google Maps JS API.
acf/fields/post_object/query Filters the $args used to query posts in the Post Object field.
acf/format_value Filters the field $value after being loaded by a template function such as get_field().
acf/load_field Filters the $field settings after being loaded.
acf/load_value Filters the field $value after being loaded.
acf/prepare_field Filters the $field settings in preparation for render.
acf/register_block_type_args Filters the arguments for registering a block type.
acf/settings Filters settings used throughout the plugin
acf/update_field Filters the $field settings before being saved.
acf/update_value Filters the field $value before being saved.
acf/upload_prefilter Used to perform validation on an attachment before it is uploaded.
acf/validate_attachment Used to perform validation on an attachment before it is uploaded or selected.
acf/validate_value Used to perform validation on the field's $value before being saved.
acf/fields/post_object/result Customize the result (text) displayed for each option in the post object field
acf/fields/relationship/query Customize the $args array used to query posts for the relationship field
acf/fields/relationship/result Customize the result (text) displayed for each option in the relationship field
acf/fields/taxonomy/query Customize the $args array used to query terms for the taxonomy field (select display)
acf/fields/taxonomy/result Customize the result (text) displayed for each option in the taxonomy field
acf/fields/taxonomy/wp_list_categories Customize the $args array used to query and list terms for the taxonomy field (checkbox and radio display)
acf/pre_save_post Customize the $post_id used to save data during the acf_form_head() function
Deprecated
acf/options_page/settings

Frequently Asked Questions

We curated an extensive list of frequently asked questions to help you quickly get on with your project.

If you have a question regarding the ACF plugin or the ACF website, please take a look at the FAQ categories here.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.