wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_logout_url › WordPress Function

Since2.7.0
Deprecatedn/a
wp_logout_url ( $redirect = '' )
Parameters:
  • (string) $redirect Path to redirect to on logout.
    Required: No
    Default: (empty)
Returns:
  • (string) The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
Defined at:
Codex:

Retrieves the logout URL.

Returns the URL that allows the user to log out of the site.


Source

function wp_logout_url( $redirect = '' ) {
	$args = array();
	if ( ! empty( $redirect ) ) {
		$args['redirect_to'] = urlencode( $redirect );
	}

	$logout_url = add_query_arg( $args, site_url( 'wp-login.php?action=logout', 'login' ) );
	$logout_url = wp_nonce_url( $logout_url, 'log-out' );

	/**
	 * Filters the logout URL.
	 *
	 * @since 2.8.0
	 *
	 * @param string $logout_url The HTML-encoded logout URL.
	 * @param string $redirect   Path to redirect to on logout.
	 */
	return apply_filters( 'logout_url', $logout_url, $redirect );
}