WP_Ability::check_permissions
Checks whether the ability has the necessary permissions.
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.
Method of the class: WP_Ability{}
No Hooks.
Returns
true|false|WP_Error. Whether the ability has the necessary permission.
Usage
$WP_Ability = new WP_Ability(); $WP_Ability->check_permissions( $input );
- $input(mixed)
- The valid input data for permission checking.
Default:null
Notes
- See: validate_input()
Changelog
| Since 6.9.0 | Introduced. |
WP_Ability::check_permissions() WP Ability::check permissions code WP 6.9
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 );
}