Simple function to embed instagram image in wordpress easily and without plugin or javascript, just paste instagram link in post to display original instagram image.

How To Embed Instagram Image In WordPress

Using wp_embed_register_handler() function, we will display original instagram images in your post without plugin or javascript.

Embed Instagram Image

Copy function code and paste it in your functions.php file, function code:

wp_embed_register_handler( 'original_instagram', '/https?\:\/\/\S*?\\/p\/(.+)/', 'WPTime_embed_instagram' );
function WPTime_embed_instagram( $matches, $attr, $url, $rawattr ) {
    $id = preg_replace( array("/[^&?]*?=[^&?]*/", "/[(?)]/", "/(\/p\/)/", "/(\/)/"), '', $matches[1] );
    $embed = sprintf('<img class="aligncenter" src="'.$id.'/media?size=l">');
    return apply_filters( 'original_instagram', $embed, $matches, $attr, $url, $rawattr );


In your post, just paste instagram image link, for example:

embed instagram image in wordpress

Now will be display original instagram image:


You can add multi instagram images in post, and instagram images will be align center.