HTTP/2 301
server: nginx
date: Sat, 27 Dec 2025 13:53:09 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/classes/wp_scripts/print_extra_script/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
HTTP/2 200
server: nginx
date: Sat, 27 Dec 2025 13:53:10 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
WP_Scripts::print_extra_script() – Method | Developer.WordPress.org
WordPress Developer Resources
WP_Scripts::print_extra_script()
WP_Scripts::print_extra_script( string $handle, bool $display = true ): bool|string|void
Prints extra scripts of a registered script.
$handlestringrequiredThe script’s registered handle.
$displaybooloptionalWhether to print the extra script instead of just returning it.
Default:true
bool|string|void Void if no data exists, extra scripts if $display is true, true otherwise.
public function print_extra_script( $handle, $display = true ) {
$output = $this->get_data( $handle, 'data' );
if ( ! $output ) {
return;
}
if ( ! $display ) {
return $output;
}
wp_print_inline_script_tag( $output, array( 'id' => "{$handle}-js-extra" ) );
return true;
}
View all references View on Trac View on GitHub
| Version | Description |
|---|
| 3.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.