[wp-trac] [WordPress Trac] #23431: [embed] shortcode doesn't work with do_shortcode()

WordPress Trac noreply at wordpress.org
Fri Jun 27 00:26:28 UTC 2025


#23431: [embed] shortcode doesn't work with do_shortcode()
-------------------------------------------------+-------------------------
 Reporter:  jtsternberg                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Embeds                               |     Version:  3.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-test-info has-unit-    |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing needs-unit-tests => has-patch has-
     test-info has-unit-tests
 * type:  feature request => defect (bug)


Comment:

 == Test Report
 === Description
 ✅ This report validates that the indicated patch works as expected.

 Patch tested:
 https://core.trac.wordpress.org/attachment/ticket/23431/23431.3.diff

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.29.0
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 137.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-One 2.5
 - MU Plugins: None activated
 - Plugins:
   * Simple Embed Viewer 1.0.0
   * Test Reports 1.2.0

 === Testing Instructions
 1. Add the code provided in the Artifacts somewhere where it could be
 executed
 2. Alternatively, you could simply do a `do_shortcode` with an
 `[embed][/embed]` shortcode tags
 3. 🐞 Embed is not showing.

 === Expected Results
 - Embed shows with `do_shortcode`

 === Actual Results
 - ✅ Issue resolved with patch.

 === Additional Notes
 - I know that shortcodes are planned to be deprecated at some point for
 blocks, but still, they are very used and blocks are not the sole standard
 in this regard and even include a shortcodes block. This patch is
 supersimple and works fine, so I think it's a good idea to move it
 forward.

 - Little mistake: patch adds a style into 2019 theme. Don't forget to
 remove it.

 === Supplemental Artifacts

 Test Code:

 {{{
 add_action( 'admin_menu', 'add_embed_admin_menu' );

 function add_embed_admin_menu() {
         add_menu_page(
                 'Simple Embed Viewer',
                 'Embed Viewer',
                 'manage_options',
                 'simple-embed-viewer',
                 'render_embed_admin_page',
                 'dashicons-format-video'
         );
 }

 function render_embed_admin_page() {
         echo '<h1>Embedded Video</h1>';
         echo do_shortcode(
 '[embed]https://www.youtube.com/watch?v=adHJw7qDiBQ[/embed]' );
 }
 }}}

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


More information about the wp-trac mailing list