Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#37359 closed defect (bug) (worksforme)

wp_filter_pre_oembed_result() breaks SoundCloud embeds

Reported by: maffooclock's profile MaffooClock Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Embeds Keywords:
Focuses: Cc:

Description

Version 4.5.3 introduced wp_filter_pre_oembed_result() in wp-includes/embed.php, but this appears to break embedding for SoundCloud URLs, resulting in the post embedding itself where the SoundCloud Iframe is expected to be.

I've discovered that removing Line 1116 seems to restore SoundCloud embedding, although this is merely a workaround that I haven't fully tested.

Change History (5)

#1 @swissspidy
8 years ago

  • Keywords reporter-feedback added

I tested SoundCloud embeds on a number of blogs and they worked fine everywhere. If it really wouldn't work, it would mean that url_to_postid() thinks that the Soundcloud URL belongs to a post of yours. However, url_to_postid() throws away any URL that doesn't match your home URL.

I've discovered that removing Line 1116 seems to restore SoundCloud embedding, although this is merely a workaround that I haven't fully tested.

Please do not do that. First, you should never alter WordPress core code. Second, simply removing the return statement can cause more harm than good and lead to unexpected behaviour. If wp_filter_pre_oembed_result() really causes issues for you, you should unhook it like this:

remove_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result' );


Can you confirm this issue still exists when deactivating all plugins and using one of the default themes, like Twenty Sixteen? Does it only happen to SoundCloud URLs and if so, do you have an example URL to reproduce this?

#2 @MaffooClock
8 years ago

  • Resolution set to invalid
  • Status changed from new to closed

First, you should never alter WordPress core code. Second, simply removing the return statement can cause more harm than good and lead to unexpected behaviour.

Seriously? Thanks, but I really don't need the lecture on how to go about troubleshooting; it insults my intelligence. The point was to share my observations, not to be criticized as a developer. I'd already implemented the remove_filter() workaround in production, by the way.

Yes, it only happens to SoundCloud URLs (and all of them). The only other oEmbed-enabled URLs I'm using are for YouTube, and those work fine.

I've heard more than once that SoundCloud URLs are working fine on 4.5.3 sites, so the problem must be local to me. Since I don't have the time nor the will to setup a staging site to fiddle with disabling plugins and trying other themes, and since there's a 0% chance that I'll ever try to embed one of my own URLs, I'll just stick with the remove_filter() for now.

Closing this bug report.

Last edited 8 years ago by MaffooClock (previous) (diff)

#3 @swissspidy
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution changed from invalid to worksforme

#4 @swissspidy
8 years ago

  • Keywords reporter-feedback removed

#5 @jkhongusc
8 years ago

Our Enterprise just hit this exact issue. We upgraded from 4.4.2 to 4.7. After the upgrade we noticed SoundCloud embeds was broken on one of our sites exactly as the OP reports:

resulting in the post embedding itself where the SoundCloud Iframe is expected to be

Through debugging, yes by modifying WP 4.7 core, on a staging system. I was able to backtrace to wp_filter_pre_oembed_result(). IMO the bug resides in url_to_postid(). url_to_postid ('https://soundcloud.com/path') is returning the postid of the post that contains the SoundCloud embed. The configuration of the site has url_to_postid() returning self referencing postids. If I put the same SoundCloud embed on another site, it works perfectly. I am going to open a new bug for url_to_postid().

Note: See TracTickets for help on using tickets.