WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp login url

Description

This Template Tag returns the URL that allows the user to log in to the site.

Usage

 <?php echo wp_login_url$redirect ); ?> 

Parameters

$redirect
(string) (optional) URL to redirect to on login.
Default: None

Examples

Default Usage

<a href="<?php echo wp_login_url(); ?>" title="Login">Login</a>

Login and Redirect to Current Page

<a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a>

Login and Redirect to Homepage

<a href="<?php echo wp_login_url( home_url() ); ?>" title="Login">Login</a>

Notes

Change Log

Since: 2.7.0

Source File

wp_login_url() 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.