Repository navigation
Conversation
The Shortcode block render callback does not check the hidden attribute, causing previously hidden shortcode blocks to remain visible on the front end after PR WordPress#76138 disabled visibility support. Changes: - Add hidden attribute check in index.php to prevent rendering hidden shortcode blocks on the front end Fixes WordPress#78701 See WordPress#76138
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @riyak145, @krysek76. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @riyak145! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
What?
Closes #78701
The Shortcode block render callback does not check the
hiddenattribute, causing previously hidden shortcode blocks to remain
visible on the front end even in incognito mode.
Why?
PR #76138 disabled visibility support for the Shortcode block.
However, users who had previously hidden shortcode blocks still
have
{"hidden":true}saved in their database from before thatchange. The render callback was not checking this attribute,
causing those blocks to render on the front end even when
marked as hidden.
How?
Added a check for the
hiddenattribute in the render callbackin
index.php. If the block is hidden, the function returns anempty string instead of rendering the shortcode content.
Testing Instructions
{"hidden":true}to block markup:<!-- wp:shortcode {"hidden":true} -->[your_shortcode]<!-- /wp:shortcode -->Before fix: Shortcode renders visibly on front end ✗
After fix: Nothing renders — block correctly hidden