acf_field::add_actionpublicACF 5.0.0

Checks a function is_callable() before adding the action, since classes that extend acf_field might not implement all actions.

Method of the class: acf_field{}

No Hooks.

Returns

void. Nothing (null).

Usage

$acf_field = new acf_field();
$acf_field->add_action( $tag, $function_to_add, $priority, $accepted_args );
$tag(string)
The name of the action to add the callback to.
Default: ''
$function_to_add(string)
The callback to be run when the action is ran.
Default: ''
$priority(int)
The priority to add the action on.
Default: 10
$accepted_args(int)
The number of args to pass to the function.
Default: 1

Changelog

Since 5.0.0 Introduced.

acf_field::add_action() code ACF 6.8.8

public function add_action( $tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
	// Bail early if not callable
	if ( ! is_callable( $function_to_add ) ) {
		return;
	}

	add_action( $tag, $function_to_add, $priority, $accepted_args );
}