Skip to content

Commit

Permalink
Move any content output during shutdown to be injected before closing…
Browse files Browse the repository at this point in the history
… body tag
  • Loading branch information
westonruter committed Apr 29, 2018
1 parent 1e2cd22 commit 2f2a315
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions includes/class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,10 @@ public static function prepare_response( $response, $args = array() ) {
1
);
}

// Move anything after </html>, such as Query Monitor output added at shutdown, to be moved before </body>.
$response = preg_replace( '#(</body>.*</html>)(.+)#s', '$2$1', $response );

$dom = AMP_DOM_Utils::get_dom( $response );

$xpath = new DOMXPath( $dom );
Expand Down

0 comments on commit 2f2a315

Please sign in to comment.