Getting Started with ACF

Last updated Aug 25, 2023

Overview

Welcome

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 websites faster and educate your clients quicker. In this guide, you’ll learn how to:

  • Install the ACF plugin
  • Create new fields
  • Create field content
  • Display fields in your theme
  • Register custom post types and taxonomies

The Basics

Custom fields are a native part of WordPress and appear on pages, posts and custom post types, however, the native custom field interface is not very user friendly. With ACF installed, you can tailor what fields to show and what they look like. For instance, you may require a ‘Hero Image’ to be selected for your home page. You can use ACF to easily create this Image field and show it when editing the home page! Here is the difference between native custom fields and Advanced Custom Fields.

Installation

The Advanced Custom Fields plugin does not come pre-installed with WordPress so you will need to install our plugin before using its awesome features! Luckily for you, WordPress makes this a very easy process! If you are familiar with WordPress, simply login to your site and search/install the Advanced Custom Fields plugin from the plugins page. For detailed instructions, please read our step by step instruction guide.

Creating Fields

Creating new custom fields is a very easy process and can be done with just a few clicks of our user friendly field builder! You can create as many fields as you like, each with their own name, type and settings. Each field is added to a group which allows you to both organize your fields and specify the edit screens where they appear.

Field groups are used to organize fields and attach them to edit screens. Each field group contains a title, fields, location rules and visual settings. To get started with your first field group, please read our Creating a Field Group guide.

Each field contains settings to customize how the field looks (its type), where its value is saved (its name) and how it functions (its settings). These field settings can be customized when editing a field group. To learn more about field settings, please read our Field Settings guide.

Creating Content

With your fields created, it’s time to start editing your content! All our fields are very intuitive to use and display seamlessly with the WordPress admin style. You don’t need to trigger any event to show or edit custom fields, they will appear and function just like the WP post_title and post_content fields! Simply enter your content and update the post!

Fields are not just available for posts! You may also display fields your custom fields on the page, custom post type, user, taxonomy term, comment, media and custom options pages!

To get an idea of the different content you can edit in ACF, please look over the available field types.

Displaying Fields

Displaying field values is ACF’s party piece! Any field value can be returned as a PHP variable or output as HTML via the magical functions get_field() and the_field(). These functions (alongside many others) provide a developer friendly way to customize your WordPress theme without spending hours reading our docs! Here is some example code to see how our intuitive API works!

<h1><?php the_title(); ?></h1>

<?php if ( get_field('sub_heading' ) ): ?>
    <h2><?php echo esc_html( get_field('sub_heading') ); ?></h2>
<?php endif; ?>

<div class="hero">
    <?php $image = get_field('hero_image'); ?>
    <img src="<?php echo esc_url( $image['url'] ); ?>" alt="<?php echo esc_attr( $image['alt'] ); ?>" />
</div>

<?php if( have_rows('event') ): ?>
    <ul>
    <?php while( have_rows('event') ): the_row(); ?>
        <li>
            <a href="<?php echo esc_url( get_sub_field( 'url' ) ); ?>"><?php echo esc_html( get_sub_field( 'title' ) ); ?></a>
        </li>
    <?php endwhile; ?>
    </ul>
<?php endif; ?>

To learn more about our API, please see our Functions and check out our Code Examples guide.

Custom Post Types and Taxonomies

Custom post types and taxonomies turn WordPress into a full content management system. Post types give you much greater control over how your content is created, customized, displayed, and managed. Taxonomies give you the same power over how your data and content is organized and categorized.

ACF allows you to register your custom post types and taxonomies directly in the plugin. This greatly simplifies workflows by avoiding the need to register them manually with code or use another plugin. Just create a post type in the UI, then follow it up by adding an existing field group, creating a new field group and defining fields, or by creating a taxonomy.

Register a new custom post type with ACF.

Please see Post Types and Taxonomies for our in-depth guide.

Education and Support

Good work! This guide covered all the basics for getting started creating with the Advanced Custom Fields plugin, but we’ve only scratched the surface of our available resources. As you work more about ACF, you’ll discover new features, functions, and even a powerful suite of PRO features that can help you take your WordPress website to the next level. If you have any questions that weren’t addressed in this guide, visit our Resource Center for more information or contact our support team directly.