acf/input/form_data

Overview

This action is called once on the ‘input’ page within the form element and is a good place to store hidden inputs, inline scripts and templates. This function will always be called if ACF fields appear within the form, and accepts $args that related to the current screen such as $args['post_id']

Changelog

  • Since version 5.0.0

Usage

This action is called once in every form where ACF fields appear. This function accepts 1 parameter:

  • $args: (array) the current screen data including post_id and nonce.
function action_function_name( $args ) {

	echo '<input type="hidden" name="_my_hidden_input" value="TEST_IF_THIS_EXISTS_IN_SAVE_POST"';

}
add_action( 'acf/input/form_data', 'action_function_name', 10, 1 );

action_function_name should be unique function name. It cannot match any other function name already declared.

Notes

  • The WYSIWYG field uses this action to append a hidden tinymce editor on the form