From 7a6cdfbb8094fa102498935e72a7ce6fea522078 Mon Sep 17 00:00:00 2001 From: Sebastian Moran <43222124+sebastianmoran-mainwp@users.noreply.github.com> Date: Thu, 2 Dec 2021 15:13:16 -0700 Subject: [PATCH] Create amp-preload-runtime-scripts.txt https://wordpress.org/support/topic/preload-amp-runtime-2/ https://github.com/ampproject/amp-toolbox/issues/1255 --- .../AMP/amp-preload-runtime-scripts.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Execute a function on a child site/AMP/amp-preload-runtime-scripts.txt diff --git a/Execute a function on a child site/AMP/amp-preload-runtime-scripts.txt b/Execute a function on a child site/AMP/amp-preload-runtime-scripts.txt new file mode 100644 index 00000000..b2d3f86e --- /dev/null +++ b/Execute a function on a child site/AMP/amp-preload-runtime-scripts.txt @@ -0,0 +1,10 @@ +/** + * Preload AMP runtime scripts. + */ +function amp_preload_amp_runtime() { + echo sprintf( '', esc_url( 'https://cdn.ampproject.org/v0.js' ) ); + echo sprintf( '', esc_url( 'https://cdn.ampproject.org/v0.mjs' ) ); +} + +add_action( 'wp_head', 'amp_preload_amp_runtime' ); +add_action( 'amp_post_template_head', 'amp_preload_amp_runtime' );