Opened 6 years ago
#49352 new enhancement
Allow get_proxy_item to be filtered/altered before a response is sent to the editor.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Embeds | Keywords: | |
| Focuses: | javascript, rest-api | Cc: |
Description
tl;dr: Add a filter in \WP_oEmbed_Controller::get_proxy_item so certain non-oembed sites can still be embeded using a custom handler from a plugin.
Scenario: I would like to create a generic oEmbed provider on my own site similar to iframely.com. So when a user posts a link in the editor that isn't a oembed provider, I would like to be able to filter the response from \WP_oEmbed_Controller::get_proxy_item and not having it reply with return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );. In my ideal case I could catch this and pipe the URL in question through my own proxy endpoint and create a custom oEmbed result from meta and open graph tags generated from the original HTML of the link to be embeded.
Currently it seems, that I can only replace the all embeds through a custom handler, similar to what iframely does: https://github.com/itteco/iframely-wordpress/blob/master/iframely/iframely.php#L19-L23