Opened 11 years ago
Last modified 5 years ago
#24712 new enhancement
Get errors from wp_oembed_get
Reported by: | 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)
Change History (7)
#1
@
11 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Priority changed from normal to low
#2
@
10 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.
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.