WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 8 weeks ago

#25820 new defect (bug)

[embed] shortcode can't be escaped like others

Reported by: MadtownLems Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Shortcodes Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

WordPress allows the use of double brackets to escape shortcodes, so that entering [[foo]] in your page or post displays [foo]. This works great for most shortcodes, and is used in the following way on enclosed shortcodes: [[foo]Hello![/foo]]

However, this feature fails when trying to use it with core's 'embed' shortcode.

To replicate:

Enter the following in a page or post:
[[embed]http://www.youtube.com/watch?v=YLO7tCdBVrA[/embed]]

What I expect to see:
[embed]http://www.youtube.com/watch?v=YLO7tCdBVrA[/embed]

What I really see:
(null)

(Apologies for the weird mix of [, ], and special characters here. had a hard time with getting the markup to render as I wanted.)

Change History (5)

comment:1 SergeyBiryukov6 months ago

  • Description modified (diff)

comment:2 SergeyBiryukov6 months ago

As a workaround, this works for me in Text mode:

[embed]http://www.youtube.com/watch?v=YLO7tCdBVrA[/embed]
Last edited 6 months ago by SergeyBiryukov (previous) (diff)

comment:3 MadtownLems6 months ago

Ah yes, I should've proactively talked about that workaround. Thanks for reminding me.

That workaround has the following issue:

If you return to the Visual tab, those entities are converted back into [ and ], causing your shortcode to ultimately be processed.

comment:4 pavelevap5 months ago

Related #12760 ?

Note: See TracTickets for help on using tickets.