I’m a photography nut. I love using my DSLR, I’m mad about film cameras and I use Instagram all the time. I’m also a WordPress user and I have a problem with Instagram: the photos are not preserved on my own site. To fix that I installed the amazing DsgnWrks Instagram Importer plugin and I’ve been using it for years.
While testing WordPress 4.6 beta the plugin stopped working for me. I raised a support topic and I am convinced that my setup has changed. I do not doubt that the problem is mine somehow.
I’m not proficient enough to locate where the break is and I really wanted to share my Instagram photos via my blog. So I created another WordPress account on my photo blog and with my IFTTT account I used this “Instagram to Blog” recipe. That worked, but it loaded the image from Instagram and used the IFTTT URL shortner for link.
I really wanted a copy of my photo on my own server.
I know less about IFTTT recipes than I do the plugin. But I do know how to use WordPress actions and filters so I wrote a small plugin to do the following.
- Via the publish_post action look in the content for Instagram image sources and extract those URLs. The wp_extract_urls function is made for this.
- When found import those into the WordPress Media Library and attach it to the post using media_handle_sideload.
- Make that new attached image the featured image for the post.
- Look for IFTTT short URLs and expand them using a simple function I wrote.
- Once that’s done then publish the post.
You can view the code via this Gist link. I have that saved and activated as a plugin on my photo blog.
This isn’t the ideal approach for me but it works. The IFTTT recipe successfully publishes a post when I submit a photo to my Instagram account. I’m taking that data and scraping images from another web site. Generally speaking that’s not cool but until I find a cleaner way to do it I’ll have to live with it.
Tim Nolte says:
I’m currently in the same boat as you with wanting my Instagram photos natively on my WordPress site. Seems like IFTTT should be able to just do this given I can share photos on my phone to the WordPress media library via the mobile app. Is this still the solution you are using? I came across this gallery plugin (https://wordpress.org/plugins/ifttt-instagram-gallery/) that hooks up with IFTTT, however I’m not exactly interested in it’s specific solution. Thanks for your work on this as I may just go this route.
May 24, 2017 — 10:23 pm
Jan Dembowski says:
I went back to the Dsnwrks plugin. It just started working for me. 😉
https://wordpress.org/plugins/dsgnwrks-instagram-importer/
The cron job doesn’t work but I’m convinced that’s something with my installation.
May 26, 2017 — 1:21 pm