Advanced Forms for ACF version 1.9.3.2 released

Version 1.9.3.2 is now live for both Advanced Forms and Advanced Forms Pro. This is a small release, but it introduces two new action hooks that allow you to add custom markup before and after a field group renders in a form.

New Action Hooks

We’ve added the af/field_group/before_field_group and af/field_group/after_field_group action hooks. These hooks allow you to add custom markup before and after field groups, giving you more control over the structure and appearance of your forms.

Here’s an example of how you can use these hooks to add a wrapping div around a field group:

<?php
add_action( 'af/field_group/before_field_group', function ( $field_group, $form, $args ) {
if ( $form['key'] !== 'form_64c0bb30bd954' ) {
return;
}
echo '<div class="my-field-group-wrapper">';
}, 10, 3 );
add_action( 'af/field_group/after_field_group', function ( $field_group, $form, $args ) {
if ( $form['key'] !== 'form_64c0bb30bd954' ) {
return;
}
echo '</div>'; // eof .my-field-group-wrapper
}, 10, 3 );

In the above example, the af/field_group/before_field_group hook is used to open a div and add a paragraph before the field group. The af/field_group/after_field_group hook is used to add a closing paragraph and close the div after the field group.

Changelog

  • Added the af/field_group/before_field_group action hook to support custom markup before field groups.
  • Added the af/field_group/after_field_group action hook to support custom markup after field groups.

We hope these new hooks will provide you with additional flexibility when designing your forms. As always, we’re here to help if you have any questions or need assistance. Happy form building!

About the author

Phil Kurth is a web developer living in Melbourne, Australia. Phil has a long history of WordPress development and enjoys building tools to empower others in their web design/development practice.

When not working with the web, Phil is usually spending time with his two young sons or is out hiking through the Australian bush.

Good dev stuff, delivered.

Product news, tips, and other cool things we make.

We never share your data. Read our Privacy Policy

© 2016 – 2024 Hookturn Digital. All rights reserved.