Make WordPress Core

Opened 2 months ago

Closed 7 weeks ago

#64673 closed defect (bug) (fixed)

Unnecessary Leading Space in wp-login.php Class Output

Reported by: opurockey's profile opurockey Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 7.0 Priority: normal
Severity: minor Version: trunk
Component: Login and Registration Keywords: has-patch
Focuses: Cc:

Description

There is an unnecessary leading space in the class attribute construction on line 187 of wp-login.php.
$classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
The class string is generated using:

implode( ' ', $classes )

Since implode( ' ', $classes ) in line 201 already inserts a space between each class name, adding an additional leading space before the output results in a double space in the rendered class attribute.

Expected Behavior

The class attribute should not contain a leading space. The extra space should be removed to ensure clean and consistent markup.

Proposed Fix

Remove the unnecessary leading space before the implode() output so that spacing is handled solely by implode( ' ', $classes ).

Change History (3)

This ticket was mentioned in PR #10983 on WordPress/wordpress-develop by @opurockey.


2 months ago
#1

Trac ticket: https://core.trac.wordpress.org/ticket/64673

## Description

There is an unnecessary leading space in the class attribute construction on line 187 of wp-login.php.
The class string is generated using:

implode( ' ', $classes )

Since implode( ' ', $classes ) in line 201 already inserts a space between each class name, adding an additional leading space before the output results in a double space in the rendered class attribute.

## Expected Behavior

The class attribute should not contain a leading space. The extra space should be removed to ensure clean and consistent markup.

## Proposed Fix

Remove the unnecessary leading space before the implode() output so that spacing is handled solely by implode( ' ', $classes ).

## Impact

  1. Minor markup cleanup
  2. Improves code quality and consistency
  3. Prevents unintended formatting inconsistencies

#2 @SergeyBiryukov
7 weeks ago

  • Milestone changed from Awaiting Review to 7.0

#3 @SergeyBiryukov
7 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 61775:

Code Quality: Remove extra leading space in the class attribute in login_header().

Follow-up to [28096].

Props opurockey.
Fixes #64673.

Note: See TracTickets for help on using tickets.