[wp-trac] [WordPress Trac] #31602: oEmbed: Instagram URL pattern with username in URL

WordPress Trac noreply at wordpress.org
Wed Mar 11 22:48:44 UTC 2015


#31602: oEmbed: Instagram URL pattern with username in URL
-----------------------------+-----------------------------
 Reporter:  danielbachhuber  |       Owner:
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Embeds           |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+-----------------------------

Comment (by danielbachhuber):

 This works as a compatibility shim for me:

 {{{
 wp_oembed_add_provider( '#https?://instagram\.com/[^/]+?/p/.*#i',
 'https://api.instagram.com/oembed', true );
 add_filter( 'oembed_fetch_url', function( $provider, $url, $args ) {
         if ( false === stripos( $provider, 'api.instagram.com' ) ) {
                 return $provider;
         }
         $url = preg_replace( '#https?://instagram\.com/([^/]+?/)p/(.*)#i',
 'https://instagram.com/p/$2', $url );
         $provider = add_query_arg( 'url', $url, $provider );
         return $provider;
 }, 10, 3 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31602#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list