WordPress at Your Fingertips
function is not described

WC_WCCOM_Site::is_request_to_wccom_site_rest_api() protected WC 3.7.0

Check if this is a request to WCCOM Site REST API.

{} It's a method of the class: WC_WCCOM_Site{}

No Hooks.

Return

true|false.

Usage

$result = WC_WCCOM_Site::is_request_to_wccom_site_rest_api();

Changelog

Since 3.7.0 Introduced.

Code of WC_WCCOM_Site::is_request_to_wccom_site_rest_api() WC 5.8.0

protected static function is_request_to_wccom_site_rest_api() {

	if ( isset( $_REQUEST['rest_route'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		$route       = wp_unslash( $_REQUEST['rest_route'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
		$rest_prefix = '';
	} else {
		$route       = wp_unslash( add_query_arg( array() ) );
		$rest_prefix = trailingslashit( rest_get_url_prefix() );
	}

	return false !== strpos( $route, $rest_prefix . 'wccom-site/' );
}