تابع ووکامرسی wc_get_endpoint_url دریافت آدرس Rest Api دلخواه

تابع ووکامرسی wc_get_endpoint_url – دریافت آدرس Rest Api دلخواه
Syntax – سینتکس
(string) wc_get_endpoint_url( (string) $endpoint, (string) $value = '', (string) $permalink = '' );
Parameters – پارامتر ها (3)
- 1- $endpoint (string)
- 2- $value (string)
- 3- $permalink (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_endpoint_url' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-page-functions.php';
}
// The endpoint.
$endpoint = '';
// The value.
$value = '';
// The permalink.
$permalink = '';
// NOTICE! Understand what this does before running.
$result = wc_get_endpoint_url($endpoint, $value, $permalink);
Defined – محل تعریف
/includes/wc-page-functions.php
function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
if ( ! $permalink ) {
$permalink = get_permalink();
}
// Map endpoint to options
$endpoint = ! empty( WC()->query->query_vars[ $endpoint ] ) ? WC()->query->query_vars[ $endpoint ] : $endpoint;
$value = ( get_option( 'woocommerce_myaccount_edit_address_endpoint', 'edit-address' ) === $endpoint ) ? wc_edit_address_i18n( $value ) : $value;
if ( get_option( 'permalink_structure' ) ) {
if ( strstr( $permalink, '?' ) ) {
$query_string = '?' . parse_url( $permalink, PHP_URL_QUERY );
$permalink = current( explode( '?', $permalink ) );
} else {
$query_string = '';
}
$url = trailingslashit( $permalink ) . $endpoint . '/' . $value . $query_string;
} else {
$url = add_query_arg( $endpoint, $value, $permalink );
}
return apply_filters( 'woocommerce_get_endpoint_url', $url, $endpoint, $value, $permalink );
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر