WP_REST_Site_Health_Controller::validate_request_permission( string $check )

Validates if the current user can request this REST endpoint.

Parameters

$check

(string) (Required) The endpoint check being ran.

Return

(bool)

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.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 );
	}

Changelog

Version Description
5.6.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_site_health_controller/validate_request_permission