[wp-trac] [WordPress Trac] #58366: Shortcode Support Regained but Content Filters are messing with Shortcode HTML

WordPress Trac noreply at wordpress.org
Tue May 13 22:40:04 UTC 2025


#58366: Shortcode Support Regained but Content Filters are messing with Shortcode
HTML
-------------------------------------------------+-------------------------
 Reporter:  domainsupport                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Shortcodes                           |     Version:  6.2.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-test-info needs-unit-tests has-  |     Focuses:
  patch dev-feedback                             |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  needs-testing has-test-info needs-unit-tests has-patch => has-
     test-info needs-unit-tests has-patch dev-feedback


Comment:

 == Bug Reproduction and Patch Testing Report
 === Description
 βœ… This report validates that the indicated patch works as expected.

 Patch tested:
 https://core.trac.wordpress.org/attachment/ticket/58366/58366-poc.diff

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 136.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Bug Reproduction
 Following [https://core.trac.wordpress.org/ticket/58366#comment:3 this
 idea]
 1. ❌ Placing the shortcode in a post/page doesn't trigger the error
 2. 🐞 Placing the shortcode in a template does trigger (see S.A.)

 === Expected Results
 According to [https://core.trac.wordpress.org/ticket/58366#comment:65 this
 proposal],  these are the expected results to be proven:
 1. short codes are not executed in user submitted content (comments and
 other form data)
 2. that it resolves the issue with line-breaks being stripped from
 shortcodes in block themes and replaced with HTML tags
 3. paragraph and line break tags are not added inappropriately around the
 shortcode
 4. content is not stripped for users without theΒ `unfiltered_html`
 capability

 === Actual Results
 1. βœ… Comments [https://i.imgur.com/xDPfVdt.png are not rendering
 shortcodes] as expected
 2. βœ… Solves the problem with line breaks in the template
 3. βœ… Shortcode is rendered well within paragraphs of text and
 individually as a shortcode block as expected
 4. βœ… Content [https://i.imgur.com/8s1Fxxr.png seems to be restricted] for
 users without `unfiltered_html` capabilities (tested with Author user)

 === Additional Notes
 @peterwilsoncc although the patch is currently not applying, I've edited
 it manually to apply and submitting here (just in case anyone wants to
 test further with other use-case). I have not submitted a GH PR with the
 edits because you suggested that your patch needs a little more work to be
 ready to ship, so I've made this report just to inform that, at first, it
 appears to be safe to proceed with it and send a final PR for another test
 round and be ready to ship.

 === Supplemental Artifacts
 ==== Template with Shortcode:
 ===== Only Shortcode block:
 [[Image(https://i.imgur.com/fcL4qXl.png)]]
 ===== Adding paragraphs and content in between:
 [[Image(https://i.imgur.com/lcIDgUA.png)]]

 ==== Failing Result of Template with Shortcode:
 ===== Only Shortcode block:
 [[Image(https://i.imgur.com/6FhvZPs.png)]]
 ===== Adding paragraphs and content in between:
 [[Image(https://i.imgur.com/kruSF5i.png)]]

 ==== Result of Template with the Patch
 ===== Only Shortcode block:
 [[Image(https://i.imgur.com/bQPsIoH.png)]]
 ===== Adding paragraphs and content in between:
 [[Image(https://i.imgur.com/HxXNylW.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58366#comment:94>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list