Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/wp-admin/admin-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,16 @@
$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
}

$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) );
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) );
$version_without_tag = strtok( get_bloginfo( 'version' ), '-' );
$version_components = explode( '.', $version_without_tag );
$version_class = 'version-' . implode( '-', $version_components );
Comment on lines +194 to +196
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strtok( get_bloginfo( 'version' ), '-' ) strips the pre-release suffix (e.g. -beta3/-RC1) from the version early, so the computed admin body classes can no longer include the full version string. This contradicts the PR description/testing expectation of preserving a value like 7.0-beta3 in the generated class; consider building the branch-* class from the unmodified version string (with appropriate sanitization) or otherwise retaining the suffix.

Copilot uses AI. Check for mistakes.
$admin_body_class .= ' ' . $version_class;
$branch_version_components = array_slice( $version_components, 0, 2 );
if ( '0' === array_last( $branch_version_components ) ) {
array_pop( $branch_version_components );
}
$branch_class = 'branch-' . implode( '-', $branch_version_components );
$admin_body_class .= ' ' . $branch_class;
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'modern' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
Comment on lines +194 to 205
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current $branch_version_components logic, a version like 7.0-beta3 ends up producing branch-7 (slice ['7','0'], then pop the trailing 0). If the goal is to preserve the full version format in the branch class (e.g. branch-7-0-beta3 per the PR description), this needs to incorporate the full version string (including the suffix) rather than collapsing to major-only.

Suggested change
$version_without_tag = strtok( get_bloginfo( 'version' ), '-' );
$version_components = explode( '.', $version_without_tag );
$version_class = 'version-' . implode( '-', $version_components );
$admin_body_class .= ' ' . $version_class;
$branch_version_components = array_slice( $version_components, 0, 2 );
if ( '0' === array_last( $branch_version_components ) ) {
array_pop( $branch_version_components );
}
$branch_class = 'branch-' . implode( '-', $branch_version_components );
$admin_body_class .= ' ' . $branch_class;
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'modern' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
$full_version = get_bloginfo( 'version' );
$version_without_tag = strtok( $full_version, '-' );
$version_components = explode( '.', $version_without_tag );
$version_class = 'version-' . implode( '-', $version_components );
$admin_body_class .= ' ' . $version_class;
$branch_class = 'branch-' . str_replace( '.', '-', $full_version );
$admin_body_class .= ' ' . $branch_class;
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'modern' );
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );

Copilot uses AI. Check for mistakes.

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
$class .= ' active';
}
?>
<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ? 'true' : 'false' ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
<span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
</button>
<?php endforeach; ?>
Expand Down
Loading