16 Mar

ACF 6.1 Beta 1 Release

By Iain Poulson

We’re excited to announce the first beta release of ACF 6.1 and ACF 6.1 PRO.

ACF v6.1.0-beta1 is now available with all new custom post type and taxonomy registration, an improved experience when selecting the type of field, PHP 8.1 and 8.2 compatibility and more! 🎉🥳

PRO users can find the release in their account, and Free users can find the release over on GitHub.

Custom Post Types and Taxonomies

WordPress is turned into a true CMS with custom post types (CPTs) and custom fields. ACF handles the latter, but typically developers register custom post types as the first part of site build, using code or another plugin. ACF users have been asking to bring this functionality into ACF for years and we’ve listened.

You can access and create custom post types and taxonomies using the new menu items in the admin menu sidebar, under the renamed “ACF” option.

Take a look at the demo Liam Gladdy recently gave at one of our ‘ACF Chat Fridays’ open office hours sessions:

For developers wishing to extend our new features, you can see the section below on adding custom tab settings, and there are filters throughout our code to help you do this. The main filters you’re likely to want to use are acf/post_type/registration_args and acf/taxonomy/registration_args. These filters pass the final built array of registration arguments which are passed to WordPress, with two arrays passed in – the final args parsed by ACF and the raw data stored on the ACF Internal Post Type.

If you want to disable ACF’s CPTs and Taxonomies completely, you can do this with the new setting ‘enable_post_types’. Doing this will disable ACF from loading or initializing any aspect of the feature.

add_filter( 'acf/settings/enable_post_types', '__return_false' );

As you would expect from ACF, we’ve also made sure we’ve added filters to do most other things you’re likely to want to do, and we’re currently working on documenting all of them in time for the final release. Please let us know on Twitter if you have any questions about how to extend our CPT or Taxonomy implementations with filters while we complete the documentation.

Field Type Selection Improvements

Available for the first time in ACF 6.1.0-beta1 is a new way to choose which field type you need. When deciding on which field to use, the existing UI simply listed the field types in a dropdown which didn’t always make things clear. Some fields have similar names – what’s the difference between a URL and Page Link field? What does the Flexible Content field do? How do I use the Clone field?

To improve on that, we have introduced a ‘Browse Fields’ button next to the dropdown that when clicked opens a modal which showcases all the field types in an easy to search and informative way, with a description, visual representation of how the field will appear to editors, links to our documentation and tutorials for the field where we have it.

We have also improved the existing dropdown to make it easier to type to search for fields.

If you want to remove the ‘Browse Fields’ button in the admin, you can do this with the following filter:

add_filter( 'acf/field_group/enable_field_browser', '__return_false' );

Other Features

Custom Tabs for Settings

With our new tab format introduced in ACF 6.0, plugins which add settings to ACF may wish to add whole new sections to either Field Group Settings, Individual Fields Settings, Post Type Advanced Settings or Taxonomy Advanced Settings.

To support this, we’ve implemented the following new filters and actions.

To add a new tab, the following filters have been added:

acf/field_group/additional_field_settings_tabs acf/field_group/additional_group_settings_tabs acf/post_type/additional_settings_tabs acf/taxonomy/additional_settings_tabs

All of these pass one parameter, an array of $tabs as a named key array. For example, to add a new Tab called GraphQL Settings to every field, you’d use:


add_filter(
    'acf/field_group/additional_field_settings_tabs',
    function ( $tabs ) {
        $tabs['graphql-settings'] = "GraphQL Settings";
        return $tabs;
    }
);

We’ve also unified how third-party plugins should add individual settings (although all legacy actions will still work):

acf/field_group/render_field_settings_tab/$tab-key acf/field_group/render_group_settings_tab/$tab-key acf/post_type/render_settings_tab/$tab-key acf/taxonomy/render_settings_tab/$tab-key

Each of these actions will pass you the relevant object being rendered: the field, the field group, the post type or the taxonomy. For example, to add a “Admin Only?” checkbox to our new GraphQL Settings tab we created earlier:


add_action( 'acf/field_group/render_field_settings_tab/graphql-settings', 'render_custom_field_settings_tab' );
function render_custom_field_settings_tab( $field ) {
    acf_render_field_setting(
        $field,
        array(
            'label'        => 'Admin Only?',
            'instructions' => '',
            'name'         => 'admin_only',
            'type'         => 'true_false',
            'ui'           => 1,
        ),
        true
    );
}

PHP 8.1 and 8.2 support

This release includes PHP 8.1 and 8.2 support. Please test this and let us know if you find any further issues on modern PHP 8 releases. WordPress 6.2 RC2 is required to support PHP 8.1 or 8.2 as well.

Translations

ACF 6.1 introduces many new strings for CPTs and Taxonomies that will require translation into other languages. Because we now source all our translations through translate.wordpress.org, these will not be available for translation until ACF 6.1’s final release is published to the WordPress plugin directory in the coming weeks. If you use ACF in a language other than English, most of the new features will appear in English until we’ve synced those translations into the plugin after 6.1’s final release.

Wrap Up

We’d love to hear from you once you’ve had a chance to explore ACF 6.1. Tomorrow night (17th March), we’ll be hosting a North America time zone friendly version of ACF Chat Fridays at 9pm UTC/GMT (5pm US Eastern Time) where you can come and ask our developers any question you like, or give us feedback and we’d love to see you there! You can register here.

Otherwise, please let us know your feedback or bug reports from the beta. We’re aiming to get the final release of ACF 6.1 out in the coming weeks, and your feedback helps make sure this release works for everyone.

We’d also like to take a moment to thank all of our GitHub developer preview users for their help in testing the ACF 6.1 alpha release.

About the Author