Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#31602 closed enhancement (invalid)

oEmbed: Instagram URL pattern with username in URL

Reported by: danielbachhuber's profile danielbachhuber Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Embeds Keywords:
Focuses: Cc:


Instagram also gives users URLs like where pochoy_29 is the username. It would be nice to support this pattern as well.

Change History (5)

#1 @danielbachhuber
8 years ago

Hm, Instagram doesn't recognize the URL in its oEmbed endpoint:

local ➜ git:(master) ✗ http ""
Cache-Control: private, no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Language: en
Content-Length: 12
Content-Type: text/html; charset=utf-8
Date: Wed, 11 Mar 2015 22:13:59 GMT
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
Server: nginx
Set-Cookie: csrftoken=cfa31c0851fac0f68159abc2b0118ac4; expires=Wed, 09-Mar-2016 22:13:59 GMT; Max-Age=31449600; Path=/
Set-Cookie: mid=VQC-JwAEAAGONdjAY_8MxW9PSBvw; expires=Tue, 06-Mar-2035 22:13:59 GMT; Max-Age=630720000; Path=/
Vary: Cookie, Accept-Language

No URL Match

Do we have a contact there?

#2 @ocean90
8 years ago

  • Milestone changed from 4.2 to Future Release

We're already planning beta 1, definitely not 4.2.

#3 @danielbachhuber
8 years ago

This works as a compatibility shim for me:

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

This ticket was mentioned in Slack in #core by johnbillion. View the logs.

8 years ago

#5 @wonderboymusic
8 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

this URL pattern no longer works - try any image, add the username like you described, 404

Note: See TracTickets for help on using tickets.