Title: logout_url
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘logout_url’, string $logout_url, string $redirect )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#wp--skip-link--target)

Filters the logout URL.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#parameters)󠁿

 `$logout_url`string

The HTML-encoded logout URL.

`$redirect`string

Path to redirect to on logout.

## 󠀁[More Information](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#more-information)󠁿

This filter is applied to the url returned by the function [wp_logout_url()](https://developer.wordpress.org/reference/functions/wp_logout_url/).

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/general-template.php#L433)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L433-L433)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_logout_url()](https://developer.wordpress.org/reference/functions/wp_logout_url/)`wp-includes/general-template.php` |

Retrieves the logout URL.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/logout_url/?output_format=md#comment-content-4591)
 2.   [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/logout_url/#comment-4591)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Flogout_url%2F%23comment-4591)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Flogout_url%2F%23comment-4591)
 4. Example migrated from Codex:
 5. The following example changes the logout URL to a URL path relative to the home
    URL while keeping the same redirect URL.
 6.     ```php
        add_filter( 'logout_url', 'my_logout_page', 10, 2 );
        function my_logout_page( $logout_url, $redirect ) {
            return home_url( '/my-logout-page/?redirect_to=' . $redirect );
        }
        ```
    
 7.  * You have to give a higher priority, instead of 10, 20.
     * [mohdlatif](https://profiles.wordpress.org/mohdlatif/) [5 years ago](https://developer.wordpress.org/reference/hooks/logout_url/#comment-5239)
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Flogout_url%2F%3Freplytocom%3D4591%23feedback-editor-4591)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Flogout_url%2F)
before being able to contribute a note or feedback.