-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Ran into a case today where the embedded instagram URL was the following:
https://www.instagram.com/tv/Bv4WP9og8YC/
However, this failed the URL_PATTERN regex stored in includes/embeds/class-amp-instagram-embed.php
const URL_PATTERN = '#http(s?)://(www\.)?instagr(\.am|am\.com)/p/([^/?]+)#i';The regex expects the URL to have a 'p' in the URL but instagram now also allows a 'tv' in the same position. If you use either URL version in a browser the same page is displayed.
Changing the URL in the embed to use the 'p' version allowed the embed to work in AMP, however the regex should probably be adapted to accommodate the new URL format. Something like the following:
const URL_PATTERN = '#http(s?)://(www\.)?instagr(\.am|am\.com)/(p|tv)/([^/?]+)#i';I've tested this change on my own sites and it does what I expect (accepting either 'p' or 'tv' in the URL).
Do not alter or remove anything below. The following sections will be managed by moderators only.
QA testing instructions
-
Add an Instagram block to a page with the URL: https://www.instagram.com/tv/Bv4WP9og8YC/
-
Embedded Instagram post should be visible on page