[wp-trac] [WordPress Trac] #49352: Allow get_proxy_item to be filtered/altered before a response is sent to the editor.

WordPress Trac noreply at wordpress.org
Mon Feb 3 16:13:40 UTC 2020


#49352: Allow get_proxy_item to be filtered/altered before a response is sent to
the editor.
----------------------------------+-----------------------------
 Reporter:  neverything           |      Owner:  (none)
     Type:  enhancement           |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Embeds                |    Version:
 Severity:  normal                |   Keywords:
  Focuses:  javascript, rest-api  |
----------------------------------+-----------------------------
 **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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49352>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list