WP_Ability::invoke_callback( callable $callback, mixed $input = null ): mixed

In this article

Invokes a callable, ensuring the input is passed through only if the input schema is defined.

Parameters

$callbackcallablerequired
The callable to invoke.
$inputmixedoptional
The input data for the ability.

Default:null

Return

mixed The result of the callable execution.

Source

protected function invoke_callback( callable $callback, $input = null ) {
	$args = array();
	if ( ! empty( $this->get_input_schema() ) ) {
		$args[] = $input;
	}

	return $callback( ...$args );
}

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.