Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#39472 new defect (bug)

Code tag still parses embeds

Reported by: rmens's profile rmens Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Embeds Keywords: needs-patch
Focuses: Cc:

Description

WordPress 4.7.

The 'code' block in the WordPress editor behaves incorrectly.

For example:

<code>Test Test
Another
www.google.com
http://www.google.com
https://www.youtube.com/watch?v=JHw6LTuMkNQ
Foxtrot Uniform Charlie Kilo
</code>

Displays as normal code in the wp-admin, but once published it creates an embed on the page. This should not happen and the contents of the code block should be displayed without embeds.

Attachments (3)

Schermafbeelding 2017-01-04 om 21.52.47.png (21.8 KB) - added by rmens 8 years ago.
Expected output
Schermafbeelding 2017-01-04 om 21.52.54.png (542.5 KB) - added by rmens 8 years ago.
Real output
Test Example.png (22.0 KB) - added by lukecavanagh 8 years ago.
Example

Download all attachments as: .zip

Change History (8)

@rmens
8 years ago

Expected output

#1 follow-up: @lukecavanagh
8 years ago

@rmens

The YouTube link would be converted with an embed by WP automatically.

https://codex.wordpress.org/Embeds

WordPress will automatically turn the URL into a YouTube embed and provide a live preview in the visual editor.

If you used say

<code>Test Test
Another
<a href="www.google.com">www.google.com</a>
<a href="http://www.google.com">http://www.google.com</a>
<a href="https://www.youtube.com/watch?v=JHw6LTuMkNQ">https://www.youtube.com/watch?v=JHw6LTuMkNQ</a>
Foxtrot Uniform Charlie Kilo
</code>

@lukecavanagh
8 years ago

Example

#2 in reply to: ↑ 1 @rmens
8 years ago

Replying to lukecavanagh:

@rmens

The YouTube link would be converted with an embed by WP automatically.

I'm aware of this, but should that really happen inside code blocks?

#3 @lukecavanagh
8 years ago

@rmens

Not sure if having code blocks around a YouTube link would make any difference currently with the emded.

#4 @dd32
8 years ago

  • Component changed from Formatting to Embeds
  • Keywords needs-patch added

Agreed that this is bug-worthy, embeds should not be processed within <code> or <pre> tags if at all possible.

#5 @SergeyBiryukov
8 years ago

Also reported as a support forums issue after the upgrade to bbPress 2.x: #meta2469.

Note: See TracTickets for help on using tickets.