Skip to content

Commit a90d395

Browse files
committed
AMP: do not disable default embed handlers if JetPack is installed to resolve the plugins conflict
1 parent 13348b7 commit a90d395

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

iframely/iframely.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ function iframely_autop_on_amp( $content ) {
147147

148148
add_filter( 'amp_content_embed_handlers', 'maybe_disable_default_embed_handlers', 10, 2 );
149149
function maybe_disable_default_embed_handlers($embed_handler_classes) {
150-
return ! get_site_option( 'iframely_only_shortcode' ) ? array() : $embed_handler_classes;
150+
# JetPack as of version 9.0.2 asserts itself as early wp_embed_register_handler
151+
# for Facebook and Instagram, bypassing oEmbed sandbox. Presumably, this way they fix
152+
# access tokens for new oEmbed endpoints that are stored in wordpress.com accounts.
153+
# As there will be no regular oEmbed flow, we need their content handlers back here.
154+
return ! get_site_option( 'iframely_only_shortcode' ) && (! class_exists( 'Jetpack_AMP_Support' ))
155+
? array()
156+
: $embed_handler_classes;
151157
};
152158

153159

0 commit comments

Comments
 (0)