Copy Content: Keep Shortcodes Intact in the Post Content Mirror - #1373
Open
Misplon wants to merge 1 commit into
Open
Copy Content: Keep Shortcodes Intact in the Post Content Mirror#1373Misplon wants to merge 1 commit into
Misplon wants to merge 1 commit into
Conversation
Re-lands the change from #1372, reverted on develop in 8dbbf5b pending review. Suspends shortcode execution during the post content mirror render: the registry is emptied for the render's duration and a pre_do_shortcode_tag guard short-circuits shortcodes registered mid-render. Raw shortcodes survive in post_content, so has_shortcode() scans work and the shortcode renders live wherever the mirror is displayed. Sites that relied on baked output can return false from siteorigin_panels_post_content_keep_shortcodes. Fixes #1370.
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.
Re-lands #1372, which was merged and then reverted on
develop(8dbbf5b) so it could get a proper review before release. Fixes #1370.What it changes. During the Copy Content render, Page Builder empties the shortcode registry, so every widget from every plugin keeps raw
[shortcode]text in thepost_contentcopy instead of baked output. Core Text widget shortcodes have baked into the mirror since 2017. This reverses that for everyone, withsiteorigin_panels_post_content_keep_shortcodesas the opt-out.Why it exists. A form shortcode baked into the mirror displayed as a dead form wherever the mirror was shown, and the form plugin's
has_shortcode()check never found its shortcode, so its assets didn't load.The history. @AlexGStapleton asked for shortcodes to stay intact in the copy in #361 and #362. Greg's answer was a per-widget flag, which the Editor widget used for seven years. so-widgets-bundle@16abcb6a (1.58.11, March 2024) moved
do_shortcodeoutside that guard for the Block Editor, and the Editor widget started baking. so-widgets-bundle#2364, already on develop, puts it back and covers the reporter's case on its own.The question for review. Is the global version worth the surface area? The risk is anything reading
post_contentraw and expecting HTML: headless or REST consumers, a search indexer with shortcode expansion off, an email plugin. Front-end rendering is untouched.Tests: 14-method
PostContentShortcodeSuspensionTestplus aCopyContentParityTestexception-safety case. All five suites pass. Verified live on a local site through the classic editor save path.Companion: so-widgets-bundle#2366 (draft) makes the Editor widget honour the opt-out filter. Merge it only if this lands.