function wp_loginout($redirect = '', $echo = true) {}

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.


  • string $redirect: Optional path to redirect to on login/logout.
  • boolean $echo: Default to echo and not return the link.

Defined filters

  • loginout
    apply_filters('loginout', $link)
  • loginout
    apply_filters('loginout', $link)

Source code

function wp_loginout($redirect = '', $echo = true) {

	if ( ! is_user_logged_in() )

		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';


		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';

	if ( $echo )

		echo apply_filters('loginout', $link);


		return apply_filters('loginout', $link);



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: