Instagram has changed its embed code from being just an iframe to a bunch of HTML and a JS script. Very inelegant, but nothing we can do. This setup, of course, fails when called through AJAX since the JS file that’s part of the HTML does not run. Thankfully there is another official way to make it work with AJAX in two steps:
-
Include this scripts in your HMTL:
<script src="https://platform.instagram.com/en_US/embeds.js"></script> -
Runs this JS after you load the content with AJAX:
if ( typeof window.instgrm !== 'undefined' ) {
window.instgrm.Embeds.process();
}
What it does is, it looks for Instagram embeds and loads them. Best of luck!
Related Posts:
- When oEmbed fails, display an alternative
- How to change default width parameter of embedded video in wordpress?
- Is it possible to remove height and width attributes from oEmbed video embeds
- how to escape wp_oembed_get for phpcs
- Fallback for oEmbed content
- Changing Oembed max width based type of page
- WordPress refuses to show oembed URL
- How to increase image size returned from Flickr oEmbed in Twenty Twelve theme
- How to get the oEmbed type (audio, video, image etc.)?
- Disable automatic oEmbed of a youtube url within the content
- Add parameters vimeo videos using wordpress embeds
- oEmbed fails half of the times. Could I reload the request on fail?
- WordPress 5.3.x YouTube oEmbed is not working
- Getting results from wp_oembed_add_provider
- add oembed provider
- Register Embed Handler for Padlet.com
- How to Hide Ancestors/Threads in Embedded Tweets
- Use Auto Embed with get_post()
- How to modify the HTML formatting of an oEmbed link?
- OEMBED seems to have stopped working
- oEmbed not recognising Vimeo URLs
- Applying an oEmbed filter to a custom post type
- How to oEmbed MySite in WordPress
- Worrisome oembed hits
- What is the correct oembed provider base url for self-hosted wordpress sites
- Why is my oembed function modifying Twitter embed?
- Problem with oEmbed in some themes
- JSON in oembed not being internationalized (using QTranslateX)
- WordPress kills an iframe’s apostrophes
- Add title attribute to oEmbed iframe for accessibility
- What are available arguments for wp_oembed_get?
- How to disable oembed cache service?
- How to set parameters for a Twitter post using wp_oembed_get (remove rounded borders)?
- Use oEmbed for static html
- class-oembed Error
- Wrap iframes/embeds, but do it before oEmbed happens
- When formatting an oEmbed iframe, how (and where) does WordPress determine the height value?
- Avoid embedding YouTube videos and open them in a new window
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- WP Oembed not passing through the “autoplay=1” variable
- What are the Oembed Links For?
- Get first video from the post (both embed and video shortcodes)
- Featured Image of Video from oembed
- oEmbed, thumbnails and wordpress
- How to Replace YouTube Videos with a “Click to Play” Thumbnail?
- Correct regex for wp_embed_register_handler
- Modify youtube video size on one page and show another size on different page
- Detecting Embed URLs Within post_content
- Manipulating oembed_dataparse stopped working for YouTube embeds
- Enqueue script only if page has an oembed
- Displaying oEmbed errors?
- How to use oEmbeds on Post Content during AJAX requests
- Set first oembed in post to a global variable or function
- How to remove the embed_footer?
- wp_embed_register_handler is not working
- oEmbed youtube video aspect ratio
- Filter oembeds tags to modify iframe attributes
- oEmbed vimeo with add_query_arg parameters not inserted to HTML
- Remove frameborder attribute from iframes
- wp_embed_register_handler to embed html files
- oEmbed in wordpress multisite not working
- Post preview and oembed provider issue using polylang plugin with subdomains
- Run oembed separately outside the_content()
- wp_insert_post iframe missing
- Display oEmbed in the_excerpt
- WordPress, oEmbed & YouTube video’s with a ‘dash’
- How to center oEmbedded content
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- Is there a built in function to see if a URLis oEmbed Compatible?
- Add field to dashboard to update embedded URL on homepage?
- Checkbox on a meta box using CMB2 Plugin
- Is there any way to render the WordPress Gutenberg core/embed block in PHP by passing in the URL?
- How can I grab the video id of youtube?
- How do I phpunit test a post output process?
- How to set up front end editor to autoembed media for non-logged in users?
- How to register a embed handler as a fallback to a oEmbed handler?
- Viddler oEmbed not working with specified width
- oEmbed, thumbnails and wordpress
- How can I replace an oEmbed URL in post with actual embed HTML
- How to embed YouTube videos in posts without adding suggested videos at the end?
- Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)
- Advanced Custom Fields oembed only outputs YouTube URL
- How to make enqueue_embed_scripts work with the embed_template filter
- oEmbded with wp_insert_post() [embedly]
- Looking to Customize YouTube Video Embeds
- Custom meta boxes ID prefix showing on first category but not others
- Is it possible to embed a wordpress tag page on wordpress?
- Add class and change src type inside wp_oembed_get
- Auto embeds don’t work for attachment descriptions
- Cannot display the_content() after removed WordPress 5’s auto embed feature (iframe & blockquote)
- How to disable URL preview in WordPress comments
- What is the correct way to obtain access to the WP_oEmbed object?
- Advanced Custom Fields oEmbed video width and height
- Printing OEmbed URL based on Post selected w/o page refresh
- Replace Vimeo and Youtube in from scratch theme with from-the-group-up single post template?
- Remove link function from oembed image or video
- Conditionally enable autoplay when using oEmbed in a custom widget
- Completely disable oEmbed and auto-embed on frontend and post editor?
- How to cache WordPress oembed links in the page header?
- Not allowing my site to be embedded elsewhere via oEmbed