Make WordPress Core

Opened 11 years ago

Last modified 5 years ago

#24712 new enhancement

Get errors from wp_oembed_get

Reported by: slushman's profile slushman Owned by:
Milestone: Priority: low
Severity: normal Version: 3.5.2
Component: Embeds Keywords: has-patch
Focuses: Cc:

Description

Would it be possible to add error collection to the oEmbed class? It would be more useful to provide a helpful error when a remote oEmbed source is not available rather than a generic "there was an issue". As an example, if you try to use wp_oembed_get() on a YouTube video that is not allowing embedding, plugins (and/or WP itself) would have the option of returning a specific error: "The requested video doesn't not allow for embedding".

Attachments (3)

ticket-24712.patch (2.1 KB) - added by GunGeekATX 9 years ago.
Proposed patch
ticket-24712.php (859 bytes) - added by GunGeekATX 9 years ago.
Sample plugin showing functionality of patch
ticket-24712.2.patch (2.0 KB) - added by eventualo 8 years ago.
refreshed patch

Download all attachments as: .zip

Change History (7)

#1 @nacin
10 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Priority changed from normal to low

Hi slushman, thanks for the suggestion. Sorry you never got a reply for this. I'm not entirely sure what it would look like, but this seems like it'd be a good idea.

@GunGeekATX
9 years ago

Proposed patch

@GunGeekATX
9 years ago

Sample plugin showing functionality of patch

#2 @GunGeekATX
9 years ago

  • Keywords has-patch added; needs-patch removed

Added an $errors array and $xml_errors property to expose the more descriptive XML errors. Also exposed the response as $response_body so a developer can add any custom handling to a response if if was unable to be parsed. For example, YouTube returns "Unauthorized" for a video that has embedding disabled. They also return it as a 401 HTTP error, so maybe we want to take a look at exposing the HTTP response code as well.

#3 @eventualo
8 years ago

I tried the patch with the current version of WP and it didn't work.
I refreshed the patch.

@eventualo
8 years ago

refreshed patch

Note: See TracTickets for help on using tickets.