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

Filters the logout URL.


$logout_url string
The HTML-encoded logout URL.
$redirect string
Path to redirect to on logout.

Top ↑

More Information

This filter is applied to the url returned by the function wp_logout_url() .

Top ↑


File: wp-includes/general-template.php. View all references

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

Top ↑


Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Steven Lin

    Example migrated from Codex:

    The following example changes the logout URL to a URL path relative to the home URL while keeping the same redirect URL.

    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 );

You must log in before being able to contribute a note or feedback.