Skip to content

Commit

Permalink
Ensure only remaining AMP scripts are printed when preparing response
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Apr 26, 2018
1 parent 4edea76 commit 846123a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,8 @@ public static function prepare_response( $response, $args = array() ) {

// Print all scripts, some of which may have already been printed and inject into head.
ob_start();
wp_print_scripts( array_keys( $amp_scripts ) );
remove_all_filters( 'print_scripts_array' ); // Make sure only the script handles we pass in will in fact get printed.
wp_scripts()->do_items( array_keys( $amp_scripts ) );
$script_tags = ob_get_clean();
if ( ! empty( $script_tags ) ) {
$response = preg_replace(
Expand Down

0 comments on commit 846123a

Please sign in to comment.