Skip to content

Commit

Permalink
Create amp-preload-runtime-scripts.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianmoran-mainwp authored Dec 2, 2021
1 parent ff273d8 commit 7a6cdfb
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Preload AMP runtime scripts.
*/
function amp_preload_amp_runtime() {
echo sprintf( '<link as="script" href="%s" rel="preload" crossorigin="anonymous">', esc_url( 'https://cdn.ampproject.org/v0.js' ) );
echo sprintf( '<link as="script" href="%s" rel="preload" crossorigin="anonymous">', 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' );

0 comments on commit 7a6cdfb

Please sign in to comment.