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 allow you to build websites faster and educate your clients quicker.

Guides

ACF Blocks

ACF Blocks are highly customizable and powerfully dynamic. They integrate deeply with custom fields allowing PHP developers to create bespoke solutions inline with the modern WordPress block editor and theme development.

Functions

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

Basic
acf_get_field_groups()
acf_get_fields() Retrieves all the fields from a specific field group.
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_field() Returns the value of a specific field.
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_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_row() Returns an array containing all values for the current row.
get_sub_field_object() Returns the settings of a specific sub field.
get_sub_field() Returns the value 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_head() Validates and saves data submitted from an acf_form().
acf_form() Creates a front end 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/options_page/save Fires after publishing a save on an options page.
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 filters to customize your ACF experience.

acf/admin/license_key_constant_message Used to modify the admin screen message when a license key is defined in code.
acf/ajax/shortcode_capability Used to modify the capability required to access ACF data via the ACF shortcode over AJAX requests.
acf/compatibility Used to enable backwards compatibility support.
acf/field_group/auto_add_first_field Filter for determining if a new field group should render with a text field automatically.
acf/field_group/disable_field_settings_tabs Used to disable the field settings tabs in the field group editor.
acf/field_group/enable_field_browser Used to hide the ‘Browse Fields’ button to disable the field type selection modal.
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/fields/post_object/result Filters the text displayed for each post in the Post Object field.
acf/fields/relationship/query Filters the $args used to query posts in the Relationship field.
acf/fields/relationship/result Filters the text displayed for each post in the Relationship field.
acf/fields/taxonomy/query Filters the $args used to query terms in the Taxonomy field (dropdown).
acf/fields/taxonomy/result Filters the text displayed for each term in the Taxonomy field.
acf/fields/taxonomy/wp_list_categories Filters the $args used to query terms in the Taxonomy field (list).
acf/fields/user/query Filters the query `$args` used by `WP_Query` to display text for each user.
acf/fields/user/result Filters the text displayed for each user.
acf/format_value Filters the field $value after being loaded by a template function such as get_field().
acf/json/eof_newline Used to change the newline character at the end of JSON files.
acf/json/save_file_name Used to change the filename of files saved by the ACF local JSON feature.
acf/load_field Filters the $field settings after being loaded.
acf/load_value Filters the field $value after being loaded.
acf/pre_save_post Customize the $post_id used to save data during the acf_form_head() function.
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/settings/enable_options_pages_ui Used to disable the UI for registering options pages.
acf/settings/enable_post_types Used to disable the custom post type and taxonomies feature.
acf/shortcode/prevent_access Allows you to limit the fields which can be output by the ACF Shortcode. Returning true from this filter will prevent the value being output by the shortcode.
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.
Deprecated
acf/options_page/settings This filter allows you to modify the setting used by the options page add-on.

Frequently Asked Questions

We curate 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.