Skip to content

Instantly share code, notes, and snippets.

Created Jul 20, 2020
What would you like to do?
Fix Instagram embeds with Jetpack shortcodes module
// Disable Jetpack's instagram shortcode since it breaks oEmbed functionality.
add_filter( 'jetpack_shortcodes_to_include', function ( $shortcodes ) {
unset( $shortcodes['instagram'] );
return $shortcodes;
}, 99 );
// Add a simple shortcode wrapper for the embed functionality to support the shortcode format.
add_shortcode( 'instagram', function ( $atts ) {
global $wp_embed;
if ( empty( $atts['url'] ) ) {
return '';
return $wp_embed->shortcode( $atts, $atts['url'] );
} );
Copy link

This is a quick workaround for this Jetpack bug which breaks the Instagram block in WordPress. Automattic/jetpack#9331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment