wp_login_url( string $redirect = '', bool $force_reauth = false )
Retrieves the login URL.
Description Description
Parameters Parameters
- $redirect
-
(string) (Optional) Path to redirect to on log in.
Default value: ''
- $force_reauth
-
(bool) (Optional) Whether to force reauthorization, even if a cookie is present.
Default value: false
Return Return
(string) The login URL. Not HTML-encoded.
Source Source
File: wp-includes/general-template.php
function wp_login_url( $redirect = '', $force_reauth = false ) { $login_url = site_url( 'wp-login.php', 'login' ); if ( ! empty( $redirect ) ) { $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url ); } if ( $force_reauth ) { $login_url = add_query_arg( 'reauth', '1', $login_url ); } /** * Filters the login URL. * * @since 2.8.0 * @since 4.2.0 The `$force_reauth` parameter was added. * * @param string $login_url The login URL. Not HTML-encoded. * @param string $redirect The path to redirect to on login, if supplied. * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. */ return apply_filters( 'login_url', $login_url, $redirect, $force_reauth ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
Login and Redirect to Current Page
Login and Redirect to Homepage