_print_scripts()
Prints scripts (internal use only)
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
null. Nothing (null).
Usage
_print_scripts();
Notes
Global. WP_Scripts. $wp_scripts |
Global. true|false. $compress_scripts |
Changelog
| Since 2.8.0 | Introduced. |
_print_scripts() print scripts code WP 7.1
function _print_scripts() {
global $wp_scripts, $compress_scripts;
$zip = $compress_scripts ? 1 : 0;
if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
$zip = 'gzip';
}
$concat = trim( $wp_scripts->concat, ', ' );
if ( $concat ) {
if ( ! empty( $wp_scripts->print_code ) ) {
wp_print_inline_script_tag( $wp_scripts->print_code . "\n//# sourceURL=" . rawurlencode( 'js-inline-concat-' . $concat ) );
}
$concat = str_split( $concat, 128 );
$concatenated = '';
foreach ( $concat as $key => $chunk ) {
$concatenated .= "&load%5Bchunk_{$key}%5D={$chunk}";
}
$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}" . $concatenated . '&ver=' . $wp_scripts->default_version;
wp_print_script_tag( array( 'src' => $src ) );
}
if ( ! empty( $wp_scripts->print_html ) ) {
echo $wp_scripts->print_html;
}
}