WC_Helper_API::url
Using the API base, form a request URL from a given endpoint.
Method of the class: WC_Helper_API{}
No Hooks.
Returns
String. The absolute endpoint URL.
Usage
$result = WC_Helper_API::url( $endpoint, $query_string );
- $endpoint(string) (required)
- The endpoint to request.
- $query_string(string)
- Optional query string to append to the URL.
Default:''
WC_Helper_API::url() WC Helper API::url code WC 10.6.2
public static function url( $endpoint, $query_string = '' ) {
$endpoint = ltrim( $endpoint, '/' );
$endpoint = sprintf( '%s/%s/%s', self::$api_base, $endpoint, $query_string );
$endpoint = esc_url_raw( $endpoint );
$endpoint = rtrim( $endpoint, '/' );
return $endpoint;
}