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

Filters the logout URL.

Parameters

$logout_urlstring
The HTML-encoded logout URL.
$redirectstring
Path to redirect to on logout.

More Information

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

Source

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

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    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.