Skip to content

Commit 24c26b9

Browse files
committed
Use wp_get_script_tag() and wp_get_inline_script_tag() in wp-includes/functions.php.
1 parent 6b58efe commit 24c26b9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/wp-includes/functions.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6839,21 +6839,19 @@ function wp_post_preview_js() {
68396839
// Has to match the window name used in post_submit_meta_box().
68406840
$name = 'wp-preview-' . (int) $post->ID;
68416841

6842-
?>
6843-
<script>
6844-
( function() {
6842+
$js = '( function() {
68456843
var query = document.location.search;
68466844
6847-
if ( query && query.indexOf( 'preview=true' ) !== -1 ) {
6848-
window.name = '<?php echo $name; ?>';
6845+
if ( query && query.indexOf( "preview=true" ) !== -1 ) {
6846+
window.name = "' . $name . '";
68496847
}
68506848
68516849
if ( window.addEventListener ) {
6852-
window.addEventListener( 'unload', function() { window.name = ''; }, false );
6850+
window.addEventListener( "unload", function() { window.name = ""; }, false );
68536851
}
6854-
}());
6855-
</script>
6856-
<?php
6852+
}());';
6853+
6854+
wp_print_inline_script_tag( $js );
68576855
}
68586856

68596857
/**

0 commit comments

Comments
 (0)