wc_logout_url

Get logout endpoint.

Description

(string) wc_logout_url( (string) $redirect = '' ); 

Returns (string)

Parameters (1)

0. $redirect — Optional. (string) => ''
The redirect.

Usage

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

Defined (1)

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

/includes/wc-template-functions.php  
  1. function wc_logout_url( $redirect = '' ) { 
  2. $logout_endpoint = get_option( 'woocommerce_logout_endpoint' ); 
  3. $redirect = $redirect ? $redirect : wc_get_page_permalink( 'myaccount' ); 
  4.  
  5. if ( $logout_endpoint ) { 
  6. return wc_get_endpoint_url( 'customer-logout', '', $redirect ); 
  7. } else { 
  8. return wp_logout_url( $redirect );