How to Easily Embed Instagram in WordPress with oEmbed

In the past we have shown you how to embed videos, slideshare, and soundcloud in WordPress using oEmbed. One of our users asked if there was a way to easily embed Instagram in WordPress with oEmbed. The answer is YES. In this article, we will show you how to add instagram oEmbed support in WordPress.

Update: You DO NOT have to use this tutorial anymore. WordPress 3.5+ has built-in oEmbed support for Instagram.

All you have to do is open a blank .php file and call it wpb-instagram.php. Then copy the code below and save it in there. Upload the file into your plugins folder, and simply activate the plugin.

<?php
/*
Plugin Name: WPB Add Instagram oEmbed
Description: Adds oEmbed support for Instagram
Author: Syed Balkhi
Author URI: https://www.wpbeginner.com
*/

// Add Instagram oEmbed
function wpb_oembed_instagram(){
wp_oembed_add_provider( 'http://instagr.am/*/*', 'http://api.instagram.com/oembed' );
wp_oembed_add_provider( 'http://www.instagram.com/*/*', 'http://api.instagram.com/oembed' );
}
add_action('init','wpb_oembed_instagram');

Now all you have to do is paste the instagram image URL in your WordPress post on its own line. It will automatically embed the image, and boom. That’s how easy it is.