function wp_logout_url($redirect = '') {}

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


  • string $redirect: Path to redirect to on logout.

Defined filters

  • logout_url
    apply_filters('logout_url', $logout_url, $redirect)

Source code

function wp_logout_url($redirect = '') {

	$args = array( 'action' => 'logout' );

	if ( !empty($redirect) ) {

		$args['redirect_to'] = urlencode( $redirect );


	$logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));

	$logout_url = wp_nonce_url( $logout_url, 'log-out' );

	return apply_filters('logout_url', $logout_url, $redirect);



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: