is_wc_endpoint_url

Is_wc_endpoint_url - Check if an endpoint is showing.

Description

is_wc_endpoint_url( (bool) $endpoint = false ); 

Parameters (1)

0. $endpoint — Optional. (bool) => false
The endpoint.

Usage

  1. if ( !function_exists( 'is_wc_endpoint_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-conditional-functions.php'; 
  3.  
  4. // The endpoint. 
  5. $endpoint = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = is_wc_endpoint_url($endpoint); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-conditional-functions.php  
  1. function is_wc_endpoint_url( $endpoint = false ) { 
  2. global $wp; 
  3.  
  4. $wc_endpoints = WC()->query->get_query_vars(); 
  5.  
  6. if ( false !== $endpoint ) { 
  7. if ( ! isset( $wc_endpoints[ $endpoint ] ) ) { 
  8. return false; 
  9. } else { 
  10. $endpoint_var = $wc_endpoints[ $endpoint ]; 
  11.  
  12. return isset( $wp->query_vars[ $endpoint_var ] ); 
  13. } else { 
  14. foreach ( $wc_endpoints as $key => $value ) { 
  15. if ( isset( $wp->query_vars[ $key ] ) ) { 
  16. return true; 
  17.  
  18. return false;