WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#30847 closed defect (bug) (wontfix)

wp_embed_register_handler() ignores hyperlinks

Reported by: paulschreiber Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Embeds Keywords:
Focuses: Cc:

Description

When you paste a URL into a post, like so:

    https://www.youtube.com/watch?v=jYlFN8euWtE

wp_embed_register_handler() will detect it and convert it to an embed:

    <iframe width="610" height="343" src="https://www.youtube.com/embed/jYlFN8euWtE?feature=oembed" 
    frameborder="0" allowfullscreen></iframe>

However, if you paste the link first into a Google doc or Word document, and then copy and past it in to WordPress, you end up with something like this:

    <a href="https://www.youtube.com/watch?v=jYlFN8euWtE">
    https://www.youtube.com/watch?v=jYlFN8euWtE</a>

which wp_embed_register_handler() skips.

It would be nice if that could be detected as an embed.

Change History (9)

#1 @DrewAPicture
6 years ago

  • Component changed from General to Embeds

#2 follow-up: @wonderboymusic
6 years ago

If you paste rich text into a rich text editor, it will slurp the HTML from your pasteboard, I'm not sure there is much we can do here

#3 @paulschreiber
6 years ago

We should be able to detect one-line paragraphs consisting entirely of a hyperlink and format them accordingly.

#4 @Viper007Bond
6 years ago

I disagree with making this proposed change. Manually making something a hyperlink is a good way to prevent embedding and it would also be a backward breaking change. People who previously didn't have an embed would suddenly have one without expecting it.

It's not like having it be a hyperlink is bad -- readers are welcome to click through to the content. Authors should have to be slightly more specific if they want it to embed in my opinion.

#5 @dd32
6 years ago

Manually making something a hyperlink is a good way to prevent embedding and it would also be a backward breaking change.

I think there's a difference here between Pasting a link, and manually creating a link.
Pasting a link should trigger embedding, but simply having a linked url on it's own line at publish shouldn't?

#6 @Viper007Bond
6 years ago

True, I was thinking strictly about render-time filters not editor enhancements.

#8 in reply to: ↑ 2 @DrewAPicture
6 years ago

  • Keywords close added
  • Version trunk deleted

Replying to wonderboymusic:

If you paste rich text into a rich text editor, it will slurp the HTML from your pasteboard, I'm not sure there is much we can do here

I agree with this. If you paste it into Google Docs or whathaveyou, it gets converted to rich text. Not sure I'd expect it to be converted to an embed upon pasting it into TinyMCE at that point. Suggest wontfix.

#9 @chriscct7
5 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing per comments:8 and comment:5 and a general lack of interest

Note: See TracTickets for help on using tickets.