Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use block specific filters for the backward compatibility markup hooks #39321

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Mar 9, 2022

What?

This is a code quality improvement to this PR #38657
The linked PR removed some useless "div" containers from image blocks that use left/right/center alignment. It did so only for themes that support the layout feature but to retain backward compatibility the divs are added back in the frontend using the render_block callback.

But since, WP 5.7 there are specific block filters we can use instead of the generic one.

Why?

This is a code quality and a tiny perf improvement.

Testing Instructions

  • Use a classic theme.
  • Insert an image block.
  • Align it left.
  • Ensure that the div wrapper around the figure is there in the frontend.

@youknowriad youknowriad added the [Type] Code Quality Issues or PRs that relate to code quality label Mar 9, 2022
@youknowriad youknowriad requested a review from ocean90 March 9, 2022 16:18
@youknowriad youknowriad self-assigned this Mar 9, 2022
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

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

Thanks Riad!

@youknowriad youknowriad merged commit 8252133 into trunk Mar 10, 2022
@youknowriad youknowriad deleted the update/improve-backward-compatibility-image-hook branch March 10, 2022 09:17
@github-actions github-actions bot added this to the Gutenberg 12.9 milestone Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants