WP_REST_Font_Collections_Controller::get_items_permissions_check()publicWP 6.5.0

Checks whether the user has permissions to use the Fonts Collections.

Метод класса: WP_REST_Font_Collections_Controller{}

Хуков нет.

Возвращает

true|WP_Error. True if the request has write access for the item, WP_Error object otherwise.

Использование

$WP_REST_Font_Collections_Controller = new WP_REST_Font_Collections_Controller();
$WP_REST_Font_Collections_Controller->get_items_permissions_check( $request );
$request (обязательный)
-

Список изменений

С версии 6.5.0 Введена.

Код WP_REST_Font_Collections_Controller::get_items_permissions_check() WP 6.7.1

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(),
		)
	);
}