Advanced Custom Fields: Extending WordPress for Publishers
WordPress’s built-in content structure — title, body, categories, tags, featured image — covers the basics for most publishing use cases. When a publication needs richer, more structured content models — author bios with headshots and social links, event listings with dates and venues, product reviews with rating fields, press releases with distribution metadata — the standard fields run out quickly.
Advanced Custom Fields (ACF) is the plugin that WordPress publishers reach for to extend that content model. It has been the dominant solution for custom field management in WordPress for over a decade.
What ACF Does
ACF adds a field management system to WordPress that lets you define custom data fields for any post type, page, taxonomy term, user, or media item — and attach those fields to the content editing interface. The fields appear in the WordPress admin below (or alongside) the default editor, and their values are stored in the WordPress database and accessible in templates.
A news site might use ACF to add a “breaking news” toggle to posts, a “reporter email” field to author profiles, and a “related external link” field to link posts to source material. A media company might create structured data fields for film reviews: director, year, runtime, genre, rating. The plugin imposes no limits on what fields you create or how you use them.
Field Types
ACF provides over 30 field types. The ones publishers use most:
Text and content: Text (single line), Textarea (multi-line), WYSIWYG (rich text editor), Markdown (with the appropriate add-on).
Media: Image (returns image ID, URL, or array), File, oEmbed (for video and audio embed URLs).
Selection: Select (dropdown), Checkbox (multiple selection), Radio (single selection), True/False (toggle).
Relational: Post Object (links to another post), Taxonomy (links to a taxonomy term), User (links to a user), Relationship (complex many-to-many post relationships).
Layout: Repeater (a repeating group of sub-fields), Flexible Content (multiple layout types selectable per-post), Group (grouped set of fields with a shared interface).
DateTime: Date Picker, Time Picker, Date Time Picker.
Other: URL, Email, Number, Range, Color Picker, Google Map, Gallery.
Creating a Field Group
In the WordPress admin, navigate to ACF → Field Groups → Add New.
Define the field group name (this is the label that appears in the editor), then add fields one by one. Each field requires:
- Field Label — what appears in the editor
- Field Name — the key used to retrieve the value in templates (auto-generated from label, lowercase with underscores)
- Field Type — the input type
- Default Value — optional, what the field contains before the editor fills it
- Required — whether the field must be filled before the post can be saved
After adding fields, set the Location Rules — the conditions under which this field group appears. Common rules: “Post Type is equal to Post,” “Taxonomy is equal to Category,” “Post Format is equal to Video.”
Retrieving Field Values in Templates
ACF provides the get_field() function to retrieve field values in PHP templates:
<?php
// Get a simple text field
$subtitle = get_field('subtitle');
// Display it
if ($subtitle) {
echo '<p class="subtitle">' . esc_html($subtitle) . '</p>';
}
?>
The the_field() function echoes the value directly:
<p class="author-title"><?php the_field('author_title'); ?></p>
For image fields (which return an array by default):
<?php
$headshot = get_field('author_headshot');
if ($headshot): ?>
<img src="<?php echo esc_url($headshot['url']); ?>"
alt="<?php echo esc_attr($headshot['alt']); ?>"
width="<?php echo esc_attr($headshot['width']); ?>"
height="<?php echo esc_attr($headshot['height']); ?>">
<?php endif; ?>
The Repeater Field
The Repeater field is one of ACF’s most powerful features — it creates a set of sub-fields that editors can add, remove, and reorder as rows. It is the right tool for structured lists: a list of credits, a series of key facts, a table of product specifications, a collection of related links.
Define a Repeater field with sub-fields in the field group editor. In templates:
<?php if (have_rows('key_facts')): ?>
<ul class="key-facts">
<?php while (have_rows('key_facts')): the_row(); ?>
<li>
<strong><?php the_sub_field('label'); ?></strong>:
<?php the_sub_field('value'); ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Flexible Content
Flexible Content takes the Repeater concept further by allowing different “layouts” (field groups) to be added in any order. An editor can compose a post from a sequence of layout blocks: a text section, then an image with caption, then a pullquote, then another text section, then a call to action.
This is the ACF alternative to WordPress’s block editor for structured content composition. For sites with classic themes where the block editor is not used, Flexible Content enables rich compositional page building from a custom field interface.
ACF and the REST API
With ACF PRO, field values are exposed through the WordPress REST API automatically once enabled at the field group level. This makes ACF data available for headless WordPress implementations — your custom fields travel with the post data in API responses alongside standard WordPress fields.
ACF PRO
The free version of ACF covers text, image, and most standard field types. ACF PRO adds:
- Repeater field
- Flexible Content field
- Gallery field
- Clone field (reuse field groups)
- REST API integration
- Options Pages (global fields not tied to any post)
- Local JSON (field group definitions saved as files for version control)
For publishing sites using ACF for serious content modeling — not just adding a few extra fields — PRO is worth the annual license ($49/year). The Repeater and Flexible Content fields alone justify it for most content-heavy use cases.
Local JSON
ACF PRO’s Local JSON feature saves field group definitions as .json files in a acf-json/ directory in your theme or plugin. This enables version control of your content model alongside your theme code — field group changes are committed to Git, reviewed like code changes, and deployed alongside templates. It is essential for any publication running WordPress in a professional development workflow.