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.
Signature
wp_loginout( $redirect = '', $echo = true )
- redirect
- (string) Optional path to redirect to on login/logout.
Default:'' - echo
- (boolean) Default to echo and not return the link.
Default:true
Return
(string|null) String when retrieving, null when displaying.
Source
function wp_loginout($redirect = '', $echo = true) {
if ( ! is_user_logged_in() )
$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
else
$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
if ( $echo )
echo apply_filters('loginout', $link);
else
return apply_filters('loginout', $link);
}
WP Trac GitHub Bitbucket
Link here
-
URL
http://queryposts.com/function/wp_loginout/ -
HTML
<a href='http://queryposts.com/function/wp_loginout/'>wp_loginout()</a> -
Markdown
[wp_loginout()](http://queryposts.com/function/wp_loginout/) -
BBCode
[url=http://queryposts.com/function/wp_loginout/]wp_loginout()[/url]