wc_logout_url()WC 2.6.9

Get logout endpoint.

Hooks from the function

Return

String.

Usage

wc_logout_url( $redirect );
$redirect(string)
Redirect URL.
Default: ''

Changelog

Since 2.6.9 Introduced.

wc_logout_url() code WC 8.7.0

function wc_logout_url( $redirect = '' ) {
	$redirect = $redirect ? $redirect : apply_filters( 'woocommerce_logout_default_redirect_url', wc_get_page_permalink( 'myaccount' ) );

	if ( get_option( 'woocommerce_logout_endpoint' ) ) {
		return wp_nonce_url( wc_get_endpoint_url( 'customer-logout', '', $redirect ), 'customer-logout' );
	}

	return wp_logout_url( $redirect );
}