wp_login_url

The timeline below displays how wordpress function wp_login_url has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.6

/**
 * Retrieves the login URL.
 *
 * @since 2.7.0
 *
 * @param string $redirect     Path to redirect to on log in.
 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
 *                             Default false.
 * @return string The login URL. Not HTML-encoded.
 */
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);
}

WordPress Version: 4.3

/**
 * Returns the URL that allows the user to log in to the site.
 *
 * @since 2.7.0
 *
 * @param string $redirect     Path to redirect to on login.
 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
 * @return string A log in URL.
 */
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);
    }
    /**
     * Filter the login URL.
     *
     * @since 2.8.0
     * @since 4.2.0 The `$force_reauth` parameter was added.
     *
     * @param string $login_url    The login URL.
     * @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);
}

WordPress Version: 4.2

/**
 * Returns the Log In URL.
 *
 * Returns the URL that allows the user to log in to the site.
 *
 * @since 2.7.0
 *
 * @param string $redirect Path to redirect to on login.
 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
 * @return string A log in URL.
 */
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);
    }
    /**
     * Filter the login URL.
     *
     * @since 2.8.0
     * @since 4.2.0 The `$force_reauth` parameter was added.
     *
     * @param string $login_url    The login URL.
     * @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);
}

WordPress Version: 4.1

/**
 * Returns the Log In URL.
 *
 * Returns the URL that allows the user to log in to the site.
 *
 * @since 2.7.0
 *
 * @param string $redirect Path to redirect to on login.
 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
 * @return string A log in URL.
 */
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);
    }
    /**
     * Filter the login URL.
     *
     * @since 2.8.0
     *
     * @param string $login_url The login URL.
     * @param string $redirect  The path to redirect to on login, if supplied.
     */
    return apply_filters('login_url', $login_url, $redirect);
}

WordPress Version: 3.9

/**
 * Returns the Log In URL.
 *
 * Returns the URL that allows the user to log in to the site.
 *
 * @since 2.7.0
 *
 * @uses site_url() To generate the log in URL.
 *
 * @param string $redirect Path to redirect to on login.
 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
 * @return string A log in URL.
 */
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);
    }
    /**
     * Filter the login URL.
     *
     * @since 2.8.0
     *
     * @param string $login_url The login URL.
     * @param string $redirect  The path to redirect to on login, if supplied.
     */
    return apply_filters('login_url', $login_url, $redirect);
}

WordPress Version: 3.7

/**
 * Returns the Log In URL.
 *
 * Returns the URL that allows the user to log in to the site.
 *
 * @since 2.7.0
 * @uses site_url() To generate the log in URL.
 * @uses apply_filters() calls 'login_url' hook on final login URL.
 *
 * @param string $redirect Path to redirect to on login.
 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false.
 * @return string A log in URL.
 */
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);
    }
    return apply_filters('login_url', $login_url, $redirect);
}