Make WordPress Core

Opened 9 months ago

Closed 9 months ago

#64673 closed defect (bug) (fixed)

Unnecessary Leading Space in wp-login.php Class Output

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

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.


9 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
9 months ago

  • Milestone Awaiting Review → 7.0

#3 @SergeyBiryukov
9 months ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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.