What’s new in version 5

Overview

Version 5 introduces many new features to the Advanced Custom Fields plugin. New visual settings have been added, new fields have been created and much of the core has been rebuilt from the ground up to allow for faster and more stable development.

ACF PRO

ACF5 has moved away from the individual add-on model, towards a simplified Free & Pro version. This change will allow premium functionality to receive more updates faster than ever!

With premium add-ons no longer supported in ACF5, the repeater field, flexible content field, gallery field and options page will no longer appear to work in ACF5. To regain premium functionality, you can purchase an ACF PRO license. This license will grant access to a new plugin called ACF PRO containing all 4 premium Add-ons bundled into the core. ACF PRO is not an extension, it is a separate plugin to replace the free version.

As a token of our appreciation to your ongoing support, we are giving each existing customer a free version of ACF PRO! Please login to your store account for more info on this special offer.

Visual Updates

ACF5 also comes with a more refreshed and refined UI. Here’s a short list of some of the new visual updates:

  • The Select2 library has been added to allow for better performance on post object, page link, taxonomy and any select fields.
  • New Gallery field design
  • New oEmbed field for easy iframe embeds
  • New field group options for Label placement and Instruction placement
  • New Relationship field setting for ‘Filters’ (Search, Post Type, Taxonomy)
  • New validation¬† uses PHP + AJAX instead of JS only

Performance Updates

Rebuilding much of the core allows ACF5 to handle more fields, load, save and display data faster. It also introduces a new git friendly way to store and sync field groups between local and live websites. Here’s a short list of some of the new performance updates:

  • Select2 prevents any PHP memory / slow load issues for post object fields on large websites
  • New JSON read/write functionality automatically saves field groups to files in your theme (saves DB query time)
  • New location for field settings (post objects) allows fields to be loaded much faster on front and back end

New locations

ACF5 also adds some new locations for field groups to appear on. Previously, field groups could be added to posts, users taxonomy terms, options pages and media items. Now, fields can also be attached to comments, widgets and all user forms including the registration form!

New fields

On top of many field improvements and re-designs, there is also a new field available in ACF5. This field is called oEmbed and allows you to easily embed content from providers such as youtube and vimeo. Learn more about the oEmbed field.

New functionality

ACF5 contains a lot of new functionality which has been made available to the developer through many new functions. These functions are found in the api folder and are separated into the following files:

  • api-field-group.php: All functions to interact with a field group (add, edit, delete, etc)
  • api-field.php: All functions to interact with a field (add, edit, delete, etc)
  • api-helpers.php: All helper functions to aid speedy development
  • api-template.php: All functions for the template developer (get_field, the_field, etc)
  • api-value.php: All functions to interact with a value (add, edit, delete, etc)

ACF PRO contains another api file caled api-pro.php with extra functionality for the options page. New functions exist for the options page such as the ability to add parent level options pages, and many new settings for each page.

Local JSON

As previously mentioned, a new feature of ACF5 is an automatically created .json files. To enable this functionality, simply create a folder in your theme called acf-json. Once this folder exists, each time you save a field group, it’s data (including fields) will be saved to a .json file in this folder.

The .json files within this folder act as a cache to save ACF loading fields from the database. This improves load times when editing a field value in the backend, and also when loading a field value on the front end.

The .json files can also be used on other websites even if the field group does not exist in the database. This allows you to create fields on your local website, commit the updated or new .json files and push them to your live website.

Aside from the auto export, the primary export and import functionality which previously produces a .xml file has been replaced with .json for consistency.

Field Settings

ACF5 uses a new way to save field settings. Please don’t confuse this with field values (which are saved in the same way as before).

Previously, the field settings were saved in the wp_postmeta table. The lack of columns in this table made it impossible to relate child and parent fields and resulted in a less than ideal nested approach to saving data. This made many sub field related activities difficult and prevented functionality such as the new ‘drag / drop field between parents’.

Now, the field settings live in the wp_posts table as a post_type called acf-field. This allows for relationships, larger nested repeater fields, and faster database querying.

Please note that the tutorial for creating a field type has been updated with ACF5 compatibility. If you are a developer of a field type, please be sure to read the updated article as the changes should only take a few minutes to implement.

Actions & Filters

The actions and filters have stayed relatively the same in this version, however, please see the tables below for the full list.

Actions

Version 4 Version 5
acf/create_field acf/render_field
acf/create_field_options acf/render_field_settings
n/a acf/input/form_data
n/a acf/input/admin_footer

Filters

Version 4 Version 5
n/a acf/settings
n/a acf/validate_value
n/a acf/input/admin_l10n
acf/format_value n/a
acf/format_value_for_api acf/format_value
acf/register_fields acf/include_fields

Javascript

A new feature in ACF5 is actions & filters for javascript. ACF5 uses WP-JS-Hooks in a wrapper function which can be accessed via acf.add_action and acf.add_filter. You can learn more about the available javascript actions and filters here.

Help

We understand that there is quite a lot to take in, and if you have any concerns, please contact our support team or chat to fellow developers on the community forum!

As usual, please report any issues or problems in the community forum.

Conclusion

Version 5 is a great leap forward in the development of the Advanced Custom Fields plugin. It introduces new functionality and design, but also provides a stable groundwork for the ongoing development into the future.

Hi all. Server maintenance scheduled this Sunday 28th May. Learn more