17 Jul 20

ACF PRO 5.9 Beta4

By Elliot Condon

ACF PRO 5.9 Beta4 is now available for download 🌈☀️! This includes all the highly anticipated updates shown in our ACF 5.9 – Exciting new features announcement.

To access this release, please login to your store account and select this version from the available downloads shown on the Licenses page. Users who already have a beta version installed will find an automatic update available via the Plugins admin page.

👨‍💻 Please find the release notes below. And for the latest ACF news, follow us on Twitter @wp_acf.

New settings for content alignment

WordPress version 5.5 is just around the corner and will will introduce a bunch of new features for the block editor. One of which is a new toolbar button used to set the “xy” position of content. This button resembles a 3×3 matrix grid, and will be used primarily within the core Cover block type.

We are happy to announce compatibility with this new feature via two new settings for the acf_register_block_type() function; One to enable the feature, and the other to define its initial value. Here’s a code example to demonstrate these new settings:

functions.php

<?php 
acf_register_block_type( array(
    'name'              => 'test_align_matrix',
    'title'             => 'Test Align Matrix',
    'align_content'     => 'top left', // Specifies the default attribute value.
    'supports'          => array(
        'align_content' => true // Enables the feature.
    ),
    'render_callback'   => function( $block ){
        echo '<div class="is-position-' . esc_attr( $block['align_content'] ) . '">';
            echo '<p>' . esc_html( $block['align_content'] ) . '</p>';
        echo '</div>';
    }
));

Optimized AJAX requests

When adding a new block, there is a potential for two individual AJAX requests to be made in order to load the preview and fields HTML (depending on the “mode” setting defined). We’ve combined these multiple calls into a single AJAX request and hope to see performance gains for all users as a result!

Fixed templateLock bug

A bug was discovered in our <InnerBlocks /> implementation preventing the templateLock attribute from working as expected. This bug is now fixed, allowing developers to lock down a specific inner blocks layout.

Fixed WYSIWYG bug

An odd bug has existed for a while causing WYSIWYG fields to become unresponsive when moving a block (in edit mode) using the up and down arrows. We’ve implemented a neat solution to fix the issue and hope no one has been waiting too long for the remedy.

Finalized ACF_Location architecture

Throughout the development of version 5.9, we have been tweaking the Location system responsible for mapping field groups to object types. One of the reasons for this work is to set the foundation for planned REST API and performance enhancements – which we will discuss in the not to distant future.

We are excited to announce this foundational work is now complete! Expect to see new documentation emerging shortly regarding the ACF_Location class and how it can be used to define new location rules with only a few lines of code!

Minor enhancements

  • Tweaked styling applied to newly duplicated rows and layouts.
  • Fixed “empty block” bug caused by overuse of do_blocks().
  • Fixed bug breaking blocks with HTML comments.
  • Fixed bug causing broken “row actions” on the trashed Field Groups admin screen.
  • Fixed bug causing render flicker on the Sync Field Groups admin screen.
  • Fixed bug sometimes displaying validation errors when saving a draft.
  • Added backwards compatibility for changed ACF_Assets class methods.
  • Added action “acf/admin_print_uploader_scripts” fired when printing uploader (WP media) scripts in the footer.

 

🙌 Thanks to everyone who helped make this release possible. Think you’ve found a bug? Please post in detail a new support ticket.

About the Author