As of v1.5 you will not need to manually add this at all. You don’t currently have to add it manually in Transitional mode or Standard mode. You only need to add it in Reader mode if the iframe is not in the content. When you have an iframe outside the content in Reader mode, you currently should use this code:
add_filter( 'amp_post_template_data', function( $data ) {
$data['amp_component_scripts'] = array_merge(
$data['amp_component_scripts'],
array(
'amp-iframe' => true,
)
);
return $data;
} );
However, this will only be needed for the next 2 weeks. After v1.5 is released, it will have no effect.
Thread Starter
remiCs
(@emersong20)
Hello!
I am using the “Transition” mode, but the “amp-iframe” is not automatically inserted, see >>> https://www.montarumnegocio.com/como-revender-produtos-de-cabelo-por-catalogo/?amp
I see no <amp-iframe> element in the page. The script will be added when the AMP component is used in the page. You can see it is added on a page which does use an iframe, like: https://www.montarumnegocio.com/como-montar-um-minimercado/?amp
Thread Starter
remiCs
(@emersong20)
You’re awesome!
I appreciate a lot your support! 😀
Thank you! Please leave the plugin a review.