Make WordPress Core

Opened 13 years ago

Last modified 7 years ago

#24712 new enhancement

Get errors from wp_oembed_get

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

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 12 years ago.
Proposed patch
ticket-24712.php​ (859 bytes ) - added by GunGeekATX 12 years ago.
Sample plugin showing functionality of patch
ticket-24712.2.patch​ (2.0 KB ) - added by eventualo 11 years ago.
refreshed patch

Download all attachments as: .zip

Change History (7)

#1 @nacin
13 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release
  • Priority normal → 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
12 years ago

Proposed patch

@GunGeekATX
12 years ago

Sample plugin showing functionality of patch

#2 @GunGeekATX
12 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
11 years ago

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

@eventualo
11 years ago

refreshed patch

Note: See TracTickets for help on using tickets.