From 222df6c32996cc23b615e1fa4b0cfc13befcaef1 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Thu, 19 Dec 2024 12:26:25 +0100 Subject: [PATCH] Instagram shortcodes: support reels and videos Fixes #40680 Follow-up to #19735 Let's grab instagram IDs from reels in AMP views too. --- .../jetpack/changelog/fix-instagram-shortcode-amp-reel | 4 ++++ projects/plugins/jetpack/modules/shortcodes/instagram.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/jetpack/changelog/fix-instagram-shortcode-amp-reel diff --git a/projects/plugins/jetpack/changelog/fix-instagram-shortcode-amp-reel b/projects/plugins/jetpack/changelog/fix-instagram-shortcode-amp-reel new file mode 100644 index 0000000000000..c8d1fcedbd5d6 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-instagram-shortcode-amp-reel @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Shortcode embeds: ensure Instagram reels are properly displayed in AMP views. diff --git a/projects/plugins/jetpack/modules/shortcodes/instagram.php b/projects/plugins/jetpack/modules/shortcodes/instagram.php index ff002aeabd327..f6542354d3283 100644 --- a/projects/plugins/jetpack/modules/shortcodes/instagram.php +++ b/projects/plugins/jetpack/modules/shortcodes/instagram.php @@ -309,7 +309,7 @@ function jetpack_shortcode_instagram( $atts ) { } if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) { - $url_pattern = '#http(s?)://(www\.)?instagr(\.am|am\.com)/p/([^/?]+)#i'; + $url_pattern = '#http(s?)://(www\.)?instagr(\.am|am\.com)/(p|tv|reel)/([^/?]+)#i'; preg_match( $url_pattern, $atts['url'], $matches ); if ( ! $matches ) { return sprintf(