WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp loginout

Contents

Description

Displays a login link, or if a user is logged in, displays a logout link. An optional, redirect argument can be used to redirect the user upon login or logout.

Usage

 <?php wp_loginout$redirect$echo ); ?> 

Parameters

$redirect
(string) (optional) URL to redirect to on login/logout. This parameter is available since Version 2.8.
Default: None
$echo
(boolean) (optional) If true, echos the link, if false, returns the link as a string.
Default: true

Example

<p><?php wp_loginout(); ?></p>

Notes

Change Log

Since: 1.5.0

Source File

wp_loginout() is located in wp-includes/general-template.php.

Related

Login Tags: is_user_logged_in(), wp_login_form(), wp_loginout(), wp_logout(), wp_register()
Login URLs: wp_login_url(), wp_logout_url(), wp_lostpassword_url(), wp_registration_url()

See also index of Function Reference and index of Template Tags.