Index: src/wp-includes/general-template.php
===================================================================
--- src/wp-includes/general-template.php	(revision 41670)
+++ src/wp-includes/general-template.php	(working copy)
@@ -482,6 +482,101 @@
 }
 
 /**
+ * Provides a simple lostpassword form for use anywhere within WordPress.
+ *
+ * The lostpassword form HTML is echoed by default. Pass a false value for `$echo` to return it instead.
+ *
+ * @since 4.9.0
+ *
+ * @param array $args {
+ *     Optional. Array of options to control the form output. Default empty array.
+ *
+ *     @type bool   $echo           Whether to display the lostpassword form or return the form HTML code.
+ *                                  Default true (echo).
+ *     @type string $redirect       URL to redirect to. Must be absolute, as in "https://example.com/mypage/".
+ *                                  Default is to redirect back to the request URI.
+ *     @type string $form_id        ID attribute value for the form. Default 'lostpasswordform'.
+ *     @type string $label_username Label for the username or email address field. Default 'Username or Email Address'.
+ *     @type string $label_submit   Label for the submit button. Default 'Log In'.
+ *     @type string $id_username    ID attribute value for the username field. Default 'user_login'.
+ *     @type string $id_submit      ID attribute value for the submit button. Default 'wp-submit'.
+ *     @type string $value_username Default value for the username field. Default empty.
+ *
+ * }
+ * @return string|void String when retrieving.
+ */
+function wp_lostpassword_form( $args = array() ) {
+	$defaults = array(
+		'echo' => true,
+		// Default 'redirect' value takes the user back to the request URI.
+		'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
+		'form_id' => 'lostpasswordform',
+		'label_username' => __( 'Username or Email Address' ),
+		'label_submit' => __( 'Get New Password' ),
+		'id_username' => 'user_login',
+		'id_submit' => 'wp-submit',
+		'value_username' => '',
+	);
+
+	/**
+	 * Filters the default lostpassword form output arguments.
+	 *
+	 * @since 4.8.0
+	 *
+	 * @see wp_lostpassword_form()
+	 *
+	 * @param array $defaults An array of default lostpassword form arguments.
+	 */
+	$args = wp_parse_args( $args, apply_filters( 'lostpassword_form_defaults', $defaults ) );
+
+	/**
+	 * Filters content to display at the top of the lostpassword form.
+	 *
+	 * The filter evaluates just following the opening form tag element.
+	 *
+	 * @since 4.8.0
+	 *
+	 * @param string $content Content to display. Default empty.
+	 * @param array  $args    Array of lostpassword form arguments.
+	 */
+	$lostpassword_form_top = apply_filters( 'lostpassword_form_top', '', $args );
+
+	/**
+	 * Filters content to display at the bottom of the lostpassword form.
+	 *
+	 * The filter evaluates just preceding the closing form tag element.
+	 *
+	 * @since 4.8.0
+	 *
+	 * @param string $content Content to display. Default empty.
+	 * @param array  $args    Array of lostpassword form arguments.
+	 */
+	$lostpassword_form_bottom = apply_filters( 'login_form_bottom', '', $args );
+
+	$form = '
+		<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( add_query_arg( 'action', 'lostpassword', site_url( 'wp-login.php') ) ) . '" method="post">
+			' . $lostpassword_form_top . '
+			<p>
+				<label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '
+					<br>
+					<input type="text" name="user_login" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20">
+				</label>
+			</p>
+			<input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '">
+			<p class="submit">
+				<input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button button-primary" value="' . esc_attr( $args['label_submit'] ) . '">
+			</p>
+			' . $lostpassword_form_bottom . '
+		</form>';
+
+	if ( $args['echo'] ) {
+		echo $form;
+	} else {
+		return $form;
+	}
+}
+
+/**
  * Returns the URL that allows the user to retrieve the lost password
  *
  * @since 2.8.0
