Files
Weston Ruter e45892b023 Editor: Fix wp-elements-* CSS class name collisions for identical blocks.
The `wp_get_elements_class_name()` function previously generated CSS class names by hashing the serialized block data via `md5()`. Identical blocks received the same `wp-elements-*` class name and the Style Engine deduplicated their CSS rules into one, causing a parent block's element style (e.g. link color) to cascade down and override a child block's identical style due to CSS source order.

The function is updated to use `wp_unique_prefixed_id()` instead, generating sequential unique class names (`wp-elements-1`, `wp-elements-2`, etc.) that match the block editor's JavaScript implementation. The now-unused `$parsed_block` parameter is removed from the function signature.

PHPStan rule level 10 errors are also resolved in the related code. See #64898.

Developed in https://github.com/WordPress/wordpress-develop/pull/12126.
Follow-up to r53260, r58074.

Props tusharbharti, westonruter, wildworks.
Fixes #65435.

Built from https://develop.svn.wordpress.org/trunk@62520


git-svn-id: http://core.svn.wordpress.org/trunk@61801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-06-18 00:10:45 +00:00
..