Skip to content

Copy Content: Keep Shortcodes Intact in the Post Content Mirror - #1373

Open
Misplon wants to merge 1 commit into
developfrom
fix/1370-copy-content-shortcodes-reland
Open

Copy Content: Keep Shortcodes Intact in the Post Content Mirror#1373
Misplon wants to merge 1 commit into
developfrom
fix/1370-copy-content-shortcodes-reland

Conversation

@Misplon

@Misplon Misplon commented Sep 4, 2026

Copy link
Copy Markdown
Member

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 the post_content copy instead of baked output. Core Text widget shortcodes have baked into the mirror since 2017. This reverses that for everyone, with siteorigin_panels_post_content_keep_shortcodes as 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_shortcode outside 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_content raw 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 PostContentShortcodeSuspensionTest plus a CopyContentParityTest exception-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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy Content Bakes Shortcode Output Into the Post Content Mirror

1 participant