get_woocommerce_api_url()
Get the URL to the WooCommerce REST API.
Хуков нет.
Возвращает
Строку
. the URL.
Использование
get_woocommerce_api_url( $path );
- $path(строка) (обязательный)
- an endpoint to include in the URL.
Список изменений
С версии 2.1 | Введена. |
Код get_woocommerce_api_url() get woocommerce api url WC 8.7.0
function get_woocommerce_api_url( $path ) { if ( Constants::is_defined( 'WC_API_REQUEST_VERSION' ) ) { $version = Constants::get_constant( 'WC_API_REQUEST_VERSION' ); } else { $version = substr( WC_API::VERSION, 0, 1 ); } $url = get_home_url( null, "wc-api/v{$version}/", is_ssl() ? 'https' : 'http' ); if ( ! empty( $path ) && is_string( $path ) ) { $url .= ltrim( $path, '/' ); } return $url; }