WC_API::get_rest_api_package_version()
Get the version of the REST API package being ran. Since API package was merged into core, this now follows WC version.
Метод класса: WC_API{}
Хуков нет.
Возвращает
Строку|null
.
Использование
$WC_API = new WC_API(); $WC_API->get_rest_api_package_version();
Список изменений
С версии 3.7.0 | Введена. |
Код WC_API::get_rest_api_package_version() WC API::get rest api package version WC 8.7.0
public function get_rest_api_package_version() { if ( ! $this->is_rest_api_loaded() ) { return null; } if ( method_exists( \Automattic\WooCommerce\RestApi\Server::class, 'get_path' ) ) { $path = \Automattic\WooCommerce\RestApi\Server::get_path(); if ( 0 === strpos( $path, __DIR__ ) ) { // We are loading API from included version. return WC()->version; } } // We are loading API from external plugin. return \Automattic\WooCommerce\RestApi\Package::get_version(); }