Title: WP_REST_Site_Health_Controller::validate_request_permission
Published: December 9, 2020
Last modified: August 20, 2026

---

# WP_REST_Site_Health_Controller::validate_request_permission( string $check ): bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#changelog)

Validates if the current user can request this REST endpoint.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#parameters)󠁿

 `$check`stringrequired

The endpoint check being ran.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#return)󠁿

 bool

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#source)󠁿

    ```php
    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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php#L188)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php#L188-L202)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#hooks)󠁿

 [apply_filters( “site_health_test_rest_capability_{$check}”, string $default_capability, string $check )](https://developer.wordpress.org/reference/hooks/site_health_test_rest_capability_check/)

Filters the capability needed to run a given Site Health check.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#related)󠁿

| Uses | Description | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [WP_REST_Site_Health_Controller::register_routes()](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/register_routes/)`wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php` |

Registers API routes.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_site_health_controller%2Fvalidate_request_permission%2F)
before being able to contribute a note or feedback.