WP_Ability::check_permissions( mixed $input = null ): bool|WP_Error

Checks whether the ability has the necessary permissions.

Description

Please note that input is not automatically validated against the input schema.
Use validate_input() method to validate input before calling this method if needed.

See also

Parameters

$inputmixedoptional
The valid input data for permission checking. Default null.

Default:null

Return

bool|WP_Error Whether the ability has the necessary permission.

Source

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

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

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

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