wp_lostpassword_url

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

WordPress Version: 6.3

/**
 * Returns the URL that allows the user to reset the lost password.
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = urlencode($redirect);
    }
    if (is_multisite()) {
        $blog_details = get_site();
        $wp_login_path = $blog_details->path . 'wp-login.php';
    } else {
        $wp_login_path = 'wp-login.php';
    }
    $lostpassword_url = add_query_arg($args, network_site_url($wp_login_path, 'login'));
    /**
     * Filters the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 6.1

/**
 * Returns the URL that allows the user to reset the lost password.
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = urlencode($redirect);
    }
    if (is_multisite()) {
        $blog_details = get_blog_details();
        $wp_login_path = $blog_details->path . 'wp-login.php';
    } else {
        $wp_login_path = 'wp-login.php';
    }
    $lostpassword_url = add_query_arg($args, network_site_url($wp_login_path, 'login'));
    /**
     * Filters the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 5.5

/**
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = urlencode($redirect);
    }
    if (is_multisite()) {
        $blog_details = get_blog_details();
        $wp_login_path = $blog_details->path . 'wp-login.php';
    } else {
        $wp_login_path = 'wp-login.php';
    }
    $lostpassword_url = add_query_arg($args, network_site_url($wp_login_path, 'login'));
    /**
     * Filters the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 5.3

/**
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array();
    if (!empty($redirect)) {
        $args['redirect_to'] = urlencode($redirect);
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php?action=lostpassword', 'login'));
    /**
     * Filters the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 4.9

/**
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = urlencode($redirect);
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
    /**
     * Filters the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 4.6

/**
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = $redirect;
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
    /**
     * Filters the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 4.3

/**
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = $redirect;
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
    /**
     * Filter the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 4.1

/**
 * Returns the Lost Password URL.
 *
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = $redirect;
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
    /**
     * Filter the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 3.9

/**
 * Returns the Lost Password URL.
 *
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 *
 * @uses site_url() To generate the lost password URL
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = $redirect;
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
    /**
     * Filter the Lost Password URL.
     *
     * @since 2.8.0
     *
     * @param string $lostpassword_url The lost password page URL.
     * @param string $redirect         The path to redirect to on login.
     */
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}

WordPress Version: 3.7

/**
 * Returns the Lost Password URL.
 *
 * Returns the URL that allows the user to retrieve the lost password
 *
 * @since 2.8.0
 * @uses site_url() To generate the lost password URL
 * @uses apply_filters() calls 'lostpassword_url' hook on the lostpassword url
 *
 * @param string $redirect Path to redirect to on login.
 * @return string Lost password URL.
 */
function wp_lostpassword_url($redirect = '')
{
    $args = array('action' => 'lostpassword');
    if (!empty($redirect)) {
        $args['redirect_to'] = $redirect;
    }
    $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
    return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
}