Checks if a given request has access to read view config.
Parameters
$requestWP_REST_Requestrequired- Full details about the request.
Source
public function get_items_permissions_check( $request ) {
$kind = $request->get_param( 'kind' );
$name = $request->get_param( 'name' );
$capability = $this->get_required_capability( $kind, $name );
if ( null === $capability ) {
return new WP_Error(
'rest_view_config_invalid_entity',
__( 'Invalid entity kind or name.' ),
array( 'status' => 404 )
);
}
if ( ! current_user_can( $capability ) ) {
return new WP_Error(
'rest_cannot_read',
__( 'Sorry, you are not allowed to read view config.' ),
array( 'status' => rest_authorization_required_code() )
);
}
return true;
}
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.