Summery Summery
Retrieves the logout URL.
Syntax Syntax
Description Description
Returns the URL that allows the user to log out of the site.
Parameters Parameters
- $redirect
-
(Optional) Path to redirect to on logout.
Default value: ''
Return Return
(string) The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
Source Source
File: wp-includes/general-template.php
}
}
/**
* Display the Log In/Out link.
*
* Displays a link, which allows users to navigate to the Log In page to log in
* or log out depending on whether they are currently logged in.
*
* @since 1.5.0
*
* @param string $redirect Optional path to redirect to on login/logout.
* @param bool $echo Default to echo and not return the link.
* @return void|string Void if `$echo` argument is true, log in/out link if `$echo` is false.
*/
function wp_loginout( $redirect = '', $echo = true ) {
if ( ! is_user_logged_in() ) {
$link = '<a href="' . esc_url( wp_login_url( $redirect ) ) . '">' . __( 'Log in' ) . '</a>';
} else {
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |