WP_Ability::do_executeprotectedWP 6.9.0

Executes the ability callback.

Method of the class: WP_Ability{}

No Hooks.

Returns

Mixed|WP_Error. The result of the ability execution, or WP_Error on failure.

Usage

// protected - for code of main (parent) or child class
$result = $this->do_execute( $input );
$input(mixed)
The input data for the ability.
Default: null

Changelog

Since 6.9.0 Introduced.

WP_Ability::do_execute() code WP 7.0

protected function do_execute( $input = null ) {
	if ( ! is_callable( $this->execute_callback ) ) {
		return new WP_Error(
			'ability_invalid_execute_callback',
			/* translators: %s ability name. */
			sprintf( __( 'Ability "%s" does not have a valid execute callback.' ), esc_html( $this->name ) )
		);
	}

	return $this->invoke_callback( $this->execute_callback, $input );
}