Repository navigation
Preserve block custom CSS class in published credits output - #9
Merged
Merged
Conversation
The Credits Link block dropped any custom CSS class added via the editor's Advanced panel from the front-end output, since the render callback passed attributes straight to the shared renderer without reading className or using get_block_wrapper_attributes(). The editor preview already showed the class via useBlockProps(), so saved and published output diverged. credits_render_block() now derives the wrapper's extra class via get_block_wrapper_attributes() (WP 5.6+) with a className fallback for older WordPress, and passes it through a new optional parameter that plain shortcode calls never populate, keeping shortcode output independent of any block wrapper context. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useBlockProps()).credits_render_block()now derives the block wrapper's extra class throughget_block_wrapper_attributes()(WP 5.6+), falling back to the rawclassNameattribute on older WordPress, and merges it into the rendered<ul>class list.[credits]shortcode calls never receive this wrapper class, so shortcode rendering stays independent of any block context, as the plan requires.ul.classwas already permitted; only additional class tokens are appended, never new attributes.apiVersion: 3on both sides, no localized comparison, covered by an existing regression test) — noted inIMPROVEMENT_PLAN.mdrather than re-doing it. One plan/implementation mismatch is flagged there too: the plan asked to retain the legacy Block API v1 fallback, but 1.6.0 removed it outright instead — left as a flagged note since that's a product decision, not a bug.readme.txt,README.md).Test plan
vendor/bin/phpunit— 50 tests, 178 assertions, all passing (was 44/167 before this change)🤖 Generated with Claude Code