WP_REST_Edit_Site_Export_Controller::permissions_check()publicWP 5.9.0

Checks whether a given request has permission to export.

{} Это метод класса: WP_REST_Edit_Site_Export_Controller{}

Хуков нет.

Возвращает

WP_Error|true. True if the request has access, or WP_Error object.

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

$WP_REST_Edit_Site_Export_Controller = new WP_REST_Edit_Site_Export_Controller();
$WP_REST_Edit_Site_Export_Controller->permissions_check();

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

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

Код WP_REST_Edit_Site_Export_Controller::permissions_check() WP 6.0.2

public function permissions_check() {
	if ( current_user_can( 'edit_theme_options' ) ) {
		return true;
	}

	return new WP_Error(
		'rest_cannot_export_templates',
		__( 'Sorry, you are not allowed to export templates and template parts.' ),
		array( 'status' => rest_authorization_required_code() )
	);
}