تابع ووکامرسی get_woocommerce_api_url نحوه دریافت آدرس Rest Api

تابع ووکامرسی get_woocommerce_api_url نحوه دریافت آدرس Rest Api

تابع ووکامرسی get_woocommerce_api_url – دریافت آدرس REST API

Syntax – سینتکس

(string) get_woocommerce_api_url( (string) $path ); 

Parameters – پارامتر ها (1)

  • 1- $path (string)

Returns – مقادیر بازگشتی (string)

the URL.

Usage – نحوه استفاده

if ( !function_exists( 'get_woocommerce_api_url' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
} 
  
// an endpoint to include in the URL. 
$path = ''; 
  
// NOTICE! Understand what this does before running. 
$result = get_woocommerce_api_url($path); 
    

Defined – محل تعریف

/includes/wc-core-functions.php

function get_woocommerce_api_url( $path ) { 
    $version = defined( 'WC_API_REQUEST_VERSION' ) ? WC_API_REQUEST_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; 
} 

versions – نسخه ها

از نسخه : 2.1

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us