diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-login.php
--- a/wp/wp-login.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-login.php Fri Sep 05 18:40:08 2025 +0200
@@ -13,7 +13,7 @@
// Redirect to HTTPS login if forced to use SSL.
if ( force_ssl_admin() && ! is_ssl() ) {
- if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
+ if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit;
} else {
@@ -23,7 +23,7 @@
}
/**
- * Output the login page header.
+ * Outputs the login page header.
*
* @since 2.1.0
*
@@ -33,14 +33,18 @@
* upon successful login.
* @global string $action The action that brought the visitor to the login page.
*
- * @param string $title Optional. WordPress login Page title to display in the `
` element.
- * Default 'Log In'.
- * @param string $message Optional. Message to display in header. Default empty.
- * @param WP_Error $wp_error Optional. The error to pass. Default is a WP_Error instance.
+ * @param string|null $title Optional. WordPress login page title to display in the `` element.
+ * Defaults to 'Log In'.
+ * @param string $message Optional. Message to display in header. Default empty.
+ * @param WP_Error|null $wp_error Optional. The error to pass. Defaults to a WP_Error instance.
*/
-function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
+function login_header( $title = null, $message = '', $wp_error = null ) {
global $error, $interim_login, $action;
+ if ( null === $title ) {
+ $title = __( 'Log In' );
+ }
+
// Don't index any of these forms.
add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
add_action( 'login_head', 'wp_strict_cross_origin_referrer' );
@@ -101,13 +105,15 @@
* but maybe better if it's not removable by plugins.
*/
if ( 'loggedout' === $wp_error->get_error_code() ) {
+ ob_start();
?>
-
+
+
has_errors() ) {
- $errors = '';
- $messages = '';
+ $error_list = array();
+ $messages = '';
foreach ( $wp_error->get_error_codes() as $code ) {
$severity = $wp_error->get_error_data( $code );
foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
if ( 'message' === $severity ) {
- $messages .= ' ' . $error_message . "
\n";
+ $messages .= '' . $error_message . '
';
} else {
- $errors .= ' ' . $error_message . "
\n";
+ $error_list[] = $error_message;
}
}
}
- if ( ! empty( $errors ) ) {
+ if ( ! empty( $error_list ) ) {
+ $errors = '';
+
+ if ( count( $error_list ) > 1 ) {
+ $errors .= '';
+
+ foreach ( $error_list as $item ) {
+ $errors .= '- ' . $item . '
';
+ }
+
+ $errors .= '
';
+ } else {
+ $errors .= '' . $error_list[0] . '
';
+ }
+
/**
* Filters the error messages displayed above the login form.
*
* @since 2.1.0
*
- * @param string $errors Login error message.
+ * @param string $errors Login error messages.
*/
- echo '' . apply_filters( 'login_errors', $errors ) . "
\n";
+ $errors = apply_filters( 'login_errors', $errors );
+
+ wp_admin_notice(
+ $errors,
+ array(
+ 'type' => 'error',
+ 'id' => 'login_error',
+ 'paragraph_wrap' => false,
+ )
+ );
}
if ( ! empty( $messages ) ) {
@@ -261,7 +291,17 @@
*
* @param string $messages Login messages.
*/
- echo '' . apply_filters( 'login_messages', $messages ) . "
\n";
+ $messages = apply_filters( 'login_messages', $messages );
+
+ wp_admin_notice(
+ $messages,
+ array(
+ 'type' => 'info',
+ 'id' => 'login-message',
+ 'additional_classes' => array( 'message' ),
+ 'paragraph_wrap' => false,
+ )
+ );
}
}
} // End of login_header().
@@ -294,7 +334,7 @@
)
);
/**
- * Filter the "Go to site" link displayed in the login page footer.
+ * Filters the "Go to site" link displayed in the login page footer.
*
* @since 5.7.0
*
@@ -315,11 +355,11 @@
if (
! $interim_login &&
/**
- * Filters the Languages select input activation on the login screen.
+ * Filters whether to display the Language selector on the login screen.
*
* @since 5.9.0
*
- * @param bool Whether to display the Languages select input on the login screen.
+ * @param bool $display Whether to display the Language selector on the login screen.
*/
apply_filters( 'login_display_language_dropdown', true )
) {
@@ -328,11 +368,16 @@
if ( ! empty( $languages ) ) {
?>