WP_REST_Site_Health_Controller::validate_request_permission()
Validates if the current user can request this REST endpoint.
Метод класса: WP_REST_Site_Health_Controller{}
Хуки из метода
Возвращает
true|false
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->validate_request_permission( $check );
- $check(строка) (обязательный)
- The endpoint check being ran.
Список изменений
С версии 5.6.0 | Введена. |
Код WP_REST_Site_Health_Controller::validate_request_permission() WP REST Site Health Controller::validate request permission WP 6.5.2
protected function validate_request_permission( $check ) { $default_capability = 'view_site_health_checks'; /** * Filters the capability needed to run a given Site Health check. * * @since 5.6.0 * * @param string $default_capability The default capability required for this check. * @param string $check The Site Health check being performed. */ $capability = apply_filters( "site_health_test_rest_capability_{$check}", $default_capability, $check ); return current_user_can( $capability ); }