Checks whether the user has permissions to use the Fonts Collections.
public function get_items_permissions_check( $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
if ( current_user_can( 'edit_theme_options' ) ) {
return true;
}
return new WP_Error(
'rest_cannot_read',
__( 'Sorry, you are not allowed to access font collections.' ),
array(
'status' => rest_authorization_required_code(),
)
);
}
| Version | Description |
|---|---|
| 6.5.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_font_collections_controller/get_items_permissions_check