Zubair Akhtar logo — Muhammad Zubair Akhtar, Software Engineer

Blog

Advanced Custom Fields: ACF or Your Own Meta

Advanced custom fields: when the ACF plugin is enough for editors, and when a WordPress custom post type or your own meta should live in code.

Muhammad Zubair Akhtar

Advanced custom fields are the extra values on a post: a subtitle, an ISBN, a related book. The ACF plugin is the usual editor UI for those values. WordPress custom post types are the other half of the decision, because the value has to sit on a type, and that type is either one the ACF plugin registers or one your plugin registers with register_post_type. This page is that choice. It stays on fields and post types. Laying a page out with a builder is custom WordPress versus page builders.

I am Zubair Akhtar, a senior software engineer in Lahore, Pakistan. I ship WordPress plugins and the sites around them. The folder, the header, and the capability checks for a plugin that owns this registration are WordPress plugin development. Building or tidying the field model on a site you already run is WordPress development. If the "post" is really an account, an order, and a permission model, read Laravel vs WordPress before you add another post type.

On 18 November 2026 I read the pages linked below. The WordPress release archive listed 7.1.4, released 28 October 2026, as the latest release. The 7.1.4 note calls it a security release and says the next major release is 7.2, planned for 8 December 2026. The releases category listed WordPress 7.2 Release Candidate 1 on 17 November 2026. A release candidate is not the version this article is written against. The article is written against 7.1.4.

The ACF plugin directory page listed version 6.8.11, tested up to 7.1.4, requiring WordPress 6.2 or higher and PHP 7.4 or higher, with active installations shown as 2+ million. The ACF changelog dates 6.8.11 to 2 November 2026. I have not installed the ACF plugin, I have not installed WordPress, and I have not run the snippets below.

When advanced custom fields stay in the ACF plugin for editors, and when register_post_meta in your plugin is the right registration

Figure 1. Editors get the ACF plugin. A value that code writes gets register_post_meta. A post type can start in the ACF screen and leave as register_post_type.

What advanced custom fields store

A custom field in WordPress is post meta: a row tied to a post ID, with a key and a value. register_post_meta() describes that key to core. The reference was last modified on 20 August 2026. It was introduced in 4.9.8. It takes the post type, the meta key, and an args array, then calls register_meta() for the object type post with that post type as object_subtype. An empty string as the post type registers the key across all existing post types. The same reference's source returns false when registration does not add the key to the global registry.

The ACF plugin is a field UI and a formatting layer on top of that storage. get_field(), last updated 6 February 2024, returns the value for a field name or a field key. The second argument is the post ID, and it defaults to the current post. The third, format_value, defaults to true, which is why an image field can come back as an array or a URL instead of the attachment ID stored in the database. The fourth, escape_html, was added in 6.2.6. It defaults to false, and it only applies when format_value is true. The same page says to escape the value before you print it. For a text field I use esc_html() at the echo. The escaping page in the Common APIs Handbook, which the plugin article already cites, is the list of which function matches which context.

update_field() says each value saved in the database is given a reference of the field's key, so ACF can format the value from the field type and its settings. The same page says to pass the field key, not the field name, when you save a new value and no value exists yet. That is how ACF creates the reference. I use get_post_meta() for a key I registered myself. The 5.11 field functions note says the same thing from the other direction: get_field() runs extra queries to find a field and format it, and a value that is not an ACF field should be read with get_post_meta() from wp_postmeta, or get_option() from wp_options.

That note is also the security boundary. From ACF 5.11.2, the [acf] shortcode returns a value only for a registered ACF field. get_field() and the_field() return null for a site option that is not an ACF field. They still return post, user, and term meta even when that meta was not registered with ACF. ACF 5.12.1 applies the option restriction when you pass a field key as well as a field name. I do not use get_field() as a general meta reader.

$value = get_field( 'wpd_subtitle' );
if ( is_string( $value ) && '' !== $value ) {
	echo '<p>' . esc_html( $value ) . '</p>';
}

The call assumes the loop already has a post, because the post ID argument was left at its default. I have not executed it.

When the ACF plugin is enough

The ACF plugin is enough when an editor is the person who changes the value, and the field type is one the plugin already ships. The ACF FAQ says the free version is fully featured and contains most of the field types you need for an average website. It names ACF Blocks, Options Pages, Galleries, Repeaters, Flexible Content, and Clone as the reasons to buy PRO. Prices are in the last section, from the pricing page, not from this sentence.

The jobWhere I register itWhat reads it
An editor types a subtitle, a date, or a related postA field group in the ACF plugin, aimed at one post typeget_field(), then an escape function
A repeating set, a gallery, a clone, or a site-wide options screenACF PRO, because the FAQ lists those as PROget_field(), with the return format that field uses
An import id, a counter, or a sync time that no editor should typeregister_post_meta() in the pluginget_post_meta()
A block sidebar or a client that reads meta in the REST responseregister_post_meta() with show_in_restThe meta object on the post endpoint
A client that already reads ACF's REST shapeThe field group, with Show in REST API turned onThe acf object on the same endpoint

Location rules are the other reason the plugin earns its place. A group can show on one post type and stay off the others. That is the screen an editor actually sees. A meta key registered in PHP does not, by itself, draw that screen.

I keep the ACF plugin when the field list is still moving. Editors and I can add a text field without a deploy. Once the list is the contract of a plugin I ship to more than one site, I want the registration in that plugin, in version control, which is the Local JSON and PHP section below.

WordPress custom post types

A WordPress custom post type is a type name in the post_type column, plus the args that decide the admin screen, the URL, and the REST route. register_post_type(), last modified 20 August 2026, is the function. It was introduced in 2.9.0. show_in_rest, rest_base, and rest_controller_class arrived in 4.7.0. rest_namespace arrived in 5.9.0. The reference says registrations should not be hooked before init.

The source sanitizes the type name with sanitize_key(). An empty result, or a name longer than 20 characters, returns a WP_Error. The message says post type names must be between 1 and 20 characters. That check has been marked _doing_it_wrong since 4.2.0.

A post type registered in the ACF plugin

Post Types and Taxonomies, last updated 5 June 2023, says that as of ACF 6.1 you can register custom post types and taxonomies in the plugin, along with the fields. The same page says the PHP export generates the native WordPress registration function. After that PHP is included in the theme or the plugin, the type is no longer manageable in the ACF admin screens, and the page says you can delete it from ACF.

Registering a Custom Post Type, last updated 10 March 2025, says the required pieces are the plural label, the singular label, and the post type key. The key is generated from the singular label and can be edited. It must be lowercase letters, numbers, underscores, and dashes, with a 20 character limit. That matches the length core enforces.

The settings I actually decide, from that page:

ACF settingWhat the page says the default isThe core arg it lines up with
PublicOn. The type shows in the admin and is reachable on the frontpublic. The reference says true implies a front-end query, a UI, nav menus, and inclusion in search
HierarchicalOff. Parent and child, like pageshierarchical, default false. The reference says supports needs page-attributes to show the parent box
Show in REST APIOn. Required for the block editorshow_in_rest. In core this defaults to false
SupportsYou pick title, featured image, author, and the restsupports. Core's default, if you omit it, is title and editor
ArchiveA control for an archive URLhas_archive. Core's default is false
Rename capabilitiesOff. The type uses post capabilities such as edit_postcapability_type defaults to post. map_meta_cap defaults to false

The hierarchical note on the core reference is the one I do not want to skip. The parameter description says a hierarchical type makes WordPress load every ID of that type on each administration page load, and it names a few thousand entries as the point where that gets expensive. ACF's toggle starts off. I leave it off unless the type is a small page-like tree.

The REST default is the sharp difference. Core's show_in_rest defaults to false, and the reference says it must be true to enable the block editor. ACF's Show in REST API toggle is on by default for a type created in the plugin. A type you register yourself does not inherit that. The sample below sets it.

The same ACF page says a saved type offers a link to add a field group with the location rule already set to that type, and a link to attach field groups you already have. That is the path I use while the model is still being drawn.

Importing from Custom Post Type UI is also on the 5 June 2023 page. The import does not delete CPTUI's data. The page says to deactivate CPTUI after a successful import so the two plugins do not both register the same type.

A post type registered in your plugin

I move the type into the plugin when it is part of the plugin's contract: the URL, the capabilities, and the rewrite rules have to exist on activation, on every site that installs the plugin, without someone clicking through ACF's admin. ACF's PHP export is that move. The file it generates is register_post_type(). Keeping the exported PHP and the ACF admin copy both active is the duplicate the CPTUI note is warning about.

public does not turn on show_in_rest. supports defaults to title and editor, so custom-fields is not included unless the array says so. The block editor meta box guide says the post type needs custom-fields support for register_post_meta() to work, and show_in_rest so the block editor can load and save the meta. register_meta() says a custom post type must also declare support for custom fields for registered meta to be accessible via the REST API. The sample sets both.

add_action( 'init', 'wpd_register_book_type' );

function wpd_register_book_type() {
	register_post_type(
		'wpd_book',
		array(
			'labels'       => array(
				'name'          => 'Books',
				'singular_name' => 'Book',
			),
			'public'       => true,
			'show_in_rest' => true,
			'has_archive'  => true,
			'rewrite'      => array( 'slug' => 'books' ),
			'supports'     => array( 'title', 'editor', 'custom-fields', 'revisions' ),
		)
	);
}

wpd_book is under the 20 character cap. The prefix is the same habit as the plugin article: do not start a name with wp_. rewrite defaults to true and uses the type name as the slug, so the sample sets the public slug to books while the stored type stays wpd_book. with_front defaults to true. If the site's permalink structure starts with /blog/, the reference says the front base is prepended, and the single URL is under that prefix. has_archive is true here so the type has an archive. Core's default is false.

The reference's flushing section says permalinks need flush_rewrite_rules() once, inside the plugin activation hook, after the type is registered. It says never to flush on every request. Themes use after_switch_theme for that one call. Activation, deactivation, and the uninstall file are the plugin development article. I am not repeating them here. I have not activated this type.

A custom capability map is the case where I want the args in the plugin even if ACF's Permissions tab would rename them. The reference lists capability_type defaulting to post and map_meta_cap defaulting to false, and it points at get_post_type_capabilities() for the names core builds. ACF's Permissions tab says the default is the post capability names, and that Rename Capabilities switches to names built from the singular and plural labels. I leave the sample on the post capabilities. A type that must not share edit_posts with ordinary posts gets its own pass through that function, in the plugin, where the role grants are reviewed with it.

When the meta belongs in your plugin

register_post_meta() is the right registration when the value has rules and does not need an editor field. A counter incremented by a cron, an external id from an import, and a flag another plugin reads are all that shape. An ACF field group would draw a box nobody should fill in, and it would add a plugin dependency for one string.

The args I set come from register_meta(), last modified 20 August 2026. The source on that page is the list of defaults:

ArgDefault in the sourceWhat I set, and why
typestringstring for an ISBN. Valid values are string, boolean, integer, number, array, and object
singlefalsetrue, so the key holds one value. Left false, the value is a list
show_in_restfalsetrue when the block editor or a client must read it. Otherwise the key stays out of the response
sanitize_callbacknullsanitize_text_field for a one-line string, so the stored value is the cleaned one
auth_callbackSet from is_protected_meta() when you omit itA capability check when the key should be editable
default'' in the defaults arrayOmitted here. Since 5.5.0 a default has to match the type, or registration returns false
revisions_enabledfalseOnly with object type post, and the post type has to support revisions. Added in 6.4.0

is_protected_meta(), last modified 20 August 2026, treats a key as protected when the first character, after it strips non-printable characters, is _. The is_protected_meta filter can change that. In register_meta(), an omitted auth_callback becomes __return_false for a protected key and __return_true for any other key. A key such as _wpd_internal is not editable through the REST meta checks unless you pass an auth_callback that returns true for the users who should edit it. I keep editor-facing keys free of the leading underscore, and I still pass auth_callback, so the check is edit_posts on this sample rather than the __return_true the source assigns to an unprotected key.

Since 5.3.0, array and object are legal types. The source returns false, with a _doing_it_wrong aimed at 5.3.0, if an array is shown in the REST API without show_in_rest.schema.items. An object needs its properties in that schema. The modifying responses handbook page is where that schema is documented, including the note that register_meta() exposes the value on a meta key, and that register_rest_field() is the other tool when the value is not meta at all.

A contributed note on the register_post_meta() reference says a default registered with an empty post type is the value get_post_meta() returns even when the same key is registered again for one post type. I have not reproduced that note. When I set a default, I register it for the post type that should own it, and I do not also register that key for every type with an empty string.

add_action( 'init', 'wpd_register_book_meta' );

function wpd_register_book_meta() {
	register_post_meta(
		'wpd_book',
		'wpd_isbn',
		array(
			'type'              => 'string',
			'single'            => true,
			'show_in_rest'      => true,
			'sanitize_callback' => 'sanitize_text_field',
			'auth_callback'     => static function () {
				return current_user_can( 'edit_posts' );
			},
			'revisions_enabled' => true,
		)
	);
}

revisions_enabled is only legal here because the post type sample supports revisions. The source returns false if the object type is not post, or if the subtype does not support revisions. The capability in the callback is edit_posts because this type still uses the post capability type. A renamed capability type would check its own cap. I have not run this function.

Reading it back is get_post_meta( $post_id, 'wpd_isbn', true ). The third argument true matches single. Writing a value from an import is update_post_meta(). That pair is the path the 5.11 note points at for meta that is not an ACF field.

show_in_rest on the type and on the field

Two registrations have to agree before a client sees the value. The post type needs show_in_rest so it has a route. The REST custom content types page says 'show_in_rest' => true adds a route in the wp/v2 namespace. rest_base changes the slug, which otherwise defaults to the post type name. rest_namespace defaults to wp/v2 and can be changed from WordPress 5.9.0. The controller defaults to WP_REST_Posts_Controller.

The field is a separate switch, and ACF and core put the value in different places.

ACF fields that opt in appear on the acf key. Meta registered with show_in_rest appears on the meta key. Both can be rows in wp_postmeta.

Figure 2. The stored row is meta. The JSON key depends on who registered it. ACF uses acf. register_post_meta uses meta.

WP REST API Integration, last updated 10 March 2025, says ACF has exposed fields through the REST API since 5.11, and that field groups are hidden until you opt in. The control is Group Settings, then Show in REST API. A GET then includes an acf object. The page's book example shows author, author_bio, and author_image under acf, not under meta. ?_fields=acf returns that object, and ?_fields=acf.author returns one field. A POST updates the acf object and has to be authenticated. Passing null deletes the field's content. The page says custom post types and taxonomies created in ACF are visible in the REST API by default, namespace wp/v2, controller WP_REST_Posts_Controller for types and WP_REST_Terms_Controller for taxonomies. Advanced Configuration, then the REST API tab, is where that visibility, namespace, base, and controller are changed.

Core meta does not use the acf key. show_in_rest on register_post_meta() puts the value on meta. The post type still needs custom-fields support or that registered meta stays out of the response, which is the sentence on the register_meta() page. A block that loads meta with the core data store is the meta shape. A headless client written against ACF's docs is the acf shape. I pick the registration that matches the client I already have, and I do not register the same fact both ways and hope they stay equal.

The changelog entries at the top of the 2 November 2026 release, and the 10 September 2026 release 6.8.10, change what that REST response is allowed to contain. I am listing the ones that affect fields:

  • 6.8.10: Relationship, Post Object, Image, Gallery, and File fields enforce WordPress read permissions on referenced posts and attachments in REST responses. The REST schema no longer discloses a field group's per-object configuration in an OPTIONS request when the caller cannot read the object.
  • 6.8.11: Field values of a password-protected post are no longer shown by the [acf] shortcode, block bindings, JSON-LD output, or the REST API until the password is entered. REST no longer expands a referenced password-protected post into a full post object.
  • 6.8.11: Relationship, Post Object, and Page Link no longer reveal the title or status of a post the current user cannot read, and they no longer save a newly selected post the user cannot read. An existing selection the user cannot read is shown as "(Restricted item)" and is kept on save.

If a field is also copied into JSON-LD, the visible value and the script have to match, and a password-protected post is one of the cases the 6.8.11 note now withholds from that output. How to add and validate the script is the schema markup guide. Updating core and plugins, and the rest of the hardening list, is the WordPress security checklist.

Local JSON and fields registered in PHP

Local JSON, last updated 28 September 2023, saves field groups, post types, taxonomies, and option pages as JSON inside the theme. The folder name it tells you to create is acf-json, writable by the server. The page says 755 is enough in most cases. After you save in the ACF admin, the plugin writes a JSON file named with the item's key, and it loads settings from that file on later requests. The page's own performance claim is a smaller number of database calls for those settings. The field values are still meta reads. Page caching and object caching for the rest of the request are WordPress speed optimization. I am not turning the Local JSON sentence into a timing.

The same page says a JSON copy syncs when the item is missing from the database, or when the modified value in the file is newer than the modified date stored for the post. That is the mechanism that lets two checkouts share field groups without clicking the same screens twice. An empty index.php in the folder is the page's instruction for stopping a directory listing.

ACF 6.2 adds narrower save filters: acf/settings/save_json/key={$key}, acf/settings/save_json/name={$name}, and acf/settings/save_json/type={$post_type}. The type values the page lists are acf-field-group, acf-post-type, acf-taxonomy, and acf-ui-options-page. A custom save path also has to be added to acf/settings/load_json, or the file is written and then not loaded. Options pages are a PRO feature on the pricing page. The JSON path for an options page matters once you have that feature. Field groups and post types are the files I expect on a site that stays on the free plugin.

Register fields via PHP is the other portable form. acf_add_local_field_group() puts the group in the local cache. The page says each group key and each field key has to be unique, because the key is how ACF finds, saves, and loads the data, and a later registration with the same key overrides the earlier one. It also says to use Local JSON when the only problem is copying fields between environments. PHP registration is for a group the plugin must always have, including on a site where nobody opens the ACF admin.

The 5.11 field functions note says to register those local groups on acf/init, before any get_field() call. Calling get_field() early initializes ACF. From 5.11.2 the plugin still returns data and writes a _doing_it_wrong notice if the group was not registered yet. I hook acf/init.

What ACF PRO costs

I read the ACF PRO page on 18 November 2026. Prices there are in USD and exclude tax. The page says ACF is tax registered in Canada and that tax is calculated at checkout. I am not adding a tax figure.

The cards and the FAQ on that page are the whole price list I am willing to repeat:

LicensePrice on the pageSites, from the card or the multisite FAQ
Personal$49 per year1 website. The card says all PRO features and unlimited updates for that year, for 1 website
Freelancer$149 per yearThe multisite FAQ says a Freelancer license covers up to 10 sites
Agency$249 per yearThe same FAQ says an Agency license covers unlimited sites

The page says licenses renew automatically each year, and that you can opt out of auto-renewal from the account. Development and staging sites are ignored and do not count toward the activation limit. The detection rules are on the license activations guide linked from that FAQ. I have not copied them. For Multisite, the FAQ says the license has to cover every subsite where ACF PRO is activated. How a network shares plugins and users is WordPress Multisite. That article is the decision to use a network. This paragraph is only the license count.

PRO features named on the page are the Repeater, ACF Blocks, Flexible Content, Options Pages, the Gallery, and the Clone field. The FAQ says PRO is a standalone plugin, that it does not require the free plugin to be installed, and that upgrading does not lose data because PRO uses the same codebase. The page offers a 30 day money-back guarantee.

Flexible Content and ACF Blocks are layout tools. I am not covering them here. The comparison with a page builder is custom WordPress versus page builders. A field that editors fill in, on a post type you own, is the decision this page is for. PRO is the right purchase when the field type is on that list. It is the wrong purchase when the value has no editor and a register_post_meta() call is the whole feature.

FAQ

Is the ACF plugin enough for advanced custom fields?

Yes, when an editor changes the value and the field type is one the plugin ships. The FAQ says the free version covers most field types on an average site. Repeater, Gallery, Clone, Flexible Content, Options Pages, and ACF Blocks are the PRO list on the pricing page. A value that code writes, with no field UI, is register_post_meta() in your plugin.

Do WordPress custom post types require the ACF plugin?

No. register_post_type() on init is the core function, and it has been in WordPress since 2.9.0. ACF 6.1 adds a screen that registers the type for you and can export that same function. I use the screen while the labels, the slug, and the fields are still changing. I ship the exported PHP in the plugin once the type is part of the install.

Where does show_in_rest put an ACF field?

On the acf object, and only after the field group opts in under Group Settings. That has been the case since ACF 5.11. The REST page was last updated 10 March 2025. register_post_meta() with show_in_rest puts the value on meta instead. The post type needs show_in_rest for either route, and it needs custom-fields in supports before registered meta is included in the response. ACF's own post type screen turns Show in REST API on by default. Core's show_in_rest defaults to false.

What is the difference between get_field and get_post_meta?

get_field() loads an ACF field and, by default, formats it. An image can come back as an array. get_post_meta() returns the stored meta value. The update_field() page says to pass the field key when no value exists yet, so ACF writes the field-key reference it uses to format later reads. From 5.11.2, get_field() still returns ordinary post meta, and it returns null for an option that is not an ACF field. I use get_post_meta() for keys this plugin registered itself.

How much does ACF PRO cost?

On 18 November 2026 the PRO page listed Personal at $49 per year for 1 website, Freelancer at $149 per year, and Agency at $249 per year. The FAQ on that page says Freelancer covers up to 10 sites and Agency covers unlimited sites. Prices are USD excluding tax. Development and staging activations are ignored. I would re-read that page before buying, because a license price is whatever the page says that day.

Work with me

I look at the field list, who edits it, and which client reads it. An editor and a field type ACF already has is the plugin, with Local JSON so the group is in the repository. A value only code should write is register_post_meta(), with a type, a sanitize callback, and show_in_rest only when something actually requests it. A post type that has settled is register_post_type() in the plugin, flushed once on activation.

That work is WordPress development. Send the field list and whether an editor has to change each one. I will say which ones stay in the ACF plugin and which ones belong in the plugin code.

Discuss this with Muhammad

Message Muhammad Zubair Akhtar on WhatsApp or email [email protected].