Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#27237 closed defect (bug) (maybelater)

Instagram embeds returning bad URL

Reported by: pbearne Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.1
Component: Embeds Keywords:
Focuses: Cc:


Hi Guys

This may well be at Instagram's end

if you drop URL into e.g. http://instagram.com/p/k8CUjHsOw2/

the rendered code is

<a href="http://instagram.com/p/k8CUjHsOw2/">
<img src="http://distilleryimage6.ak.instagram.com/3e80da02a00711e387350e22d49cfb46_7.jpg" alt="Sundowner cocktail action with @NamibiaHorizons at @CrushWineBarTO" width="612" height="612">

the problem is that
http://distilleryimage6.ak.instagram.com/3e80da02a00711e387350e22d49cfb46_7.jpg is bad URL it's returning

<Message>Access Denied</Message>

a URL that works is


note. the _7 is now _8 at the end of the file name

I have poked around bit and goggled but not come up with a fix

so I am logging it here for ref and in case we need to fix it our end.


Change History (15)

#1 @SergeyBiryukov
8 years ago

Saw this too, thought it was a problem with a particular embed. Apparently not.

#2 @johnbillion
8 years ago

  • Keywords dev-feedback added

This is indeed a problem with the image referenced in the oEmbed response from Instagram.

I wonder if anyone at WordPress.com has a contact at Instagram they can pass this on to?

#3 @Viper007Bond
8 years ago

I've asked our (WP.com) partnerships team if they know anyone over there.

#5 @Danny159
8 years ago

Any news on a fix for this?

<Message>Access Denied</Message>

#6 @dominik.schwind
8 years ago

I've been looking into this issue - on wp.com they're now using the iframe-embed code. (Hello from WordCamp Zürich - I have been told in very clear words I should say that on every ticket today. :) )

I think I could write a patch either way, which one do we like - using the image or the "native" Instagram embeds?

Last edited 8 years ago by dominik.schwind (previous) (diff)

#7 @pbearne
8 years ago

Hi From WordCamp Ottawa

I am no knowledge as to which will be better so we could try both and see which patch is better

We have WordPress partner team here I will ask

#8 @dominik.schwind
8 years ago

Hello Ottawa,

pretty cool that this happens at the same time! I have looked more closely at the core code and from what I have seen, there are only two options: really mess up the core code with an ugly "if instagram" check or hope that someone manages to get through to the Instagram people.

Until then there is an ugly fix that I have put up here as a plugin: https://github.com/lostfocus/instagram-embed-fix

I submitted it to the WordPress plugin repository so I can send out an update once it becomes obsolete.

#9 @SergeyBiryukov
8 years ago

A workaround that worked for me:

function fix_instagram_images_27237( $content ) {
	// https://core.trac.wordpress.org/ticket/27237
	return preg_replace( '/(.*?)\.instagram\.com\/(.*?)_7\.jpg/', '$1.instagram.com/$2_8.jpg', $content );
add_filter( 'the_content', 'fix_instagram_images_27237' );

#10 @pbearne
8 years ago

see what you mean about a dirty fix and the preg_replace isn't that nice either

I spoke to the Automatic DEV who fixed wordpress.com and he said he would look at this ticket and push the WP.com fix to core.

Otherwise I will have to use one of the fixes here

Thanks guys

#11 follow-up: @Danny159
8 years ago

The 2 fixes above from both @dominik.schwind and @SergeyBiryukov just result in the embed not working at all.

I dont get a broken image I just get the Instagram URL coming up.

See an example here: http://thatblogger.co/ibiza-times-gone/

#12 in reply to: ↑ 11 ; follow-up: @SergeyBiryukov
8 years ago

Replying to Danny159:

I dont get a broken image I just get the Instagram URL coming up.

You seem to have the URL inside of a <p> tag:

<p style="text-align: center;">http://instagram.com/p/nZArSAwz1J/</p>

It should work on its own line, just like any other embeds:


Currently this displays a broken image, which is where the workarounds come in.

Last edited 8 years ago by SergeyBiryukov (previous) (diff)

#13 in reply to: ↑ 12 @Danny159
8 years ago

Replying to SergeyBiryukov:

Replying to Danny159:

I dont get a broken image I just get the Instagram URL coming up.

You seem to have the URL inside of a <p> tag

I have taken the <p> tag out and save it; its still not working...

It was displaying a broken image before I applied both fixes like above but after adding each of the fix codes its just not working at all now... odd.

#14 @wonderboymusic
8 years ago

#27563 was marked as a duplicate.

#15 @wonderboymusic
8 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

This is an Instagram issue, or a permissions error on their S3 bucket.

Note: See TracTickets for help on using tickets.