Fires when scripts are printed for all admin pages.
Source
do_action( 'admin_print_scripts' );
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
| CARVIEW |
Fires when scripts are printed for all admin pages.
admin_print_scripts mainly used to echo inline javascript in admin pages header.admin_print_scripts should not be used to enqueue styles or scripts on the admin pages. Use admin_enqueue_scripts instead.admin_print_scripts could be used to insert inline script in admin pages header while admin_print_footer_scripts could be used to insert inline script in admin pages footer.do_action( 'admin_print_scripts' );
| Used by | Description |
|---|---|
iframe_header()wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
wp_iframe()wp-admin/includes/media.php | Outputs the iframe to display the media upload page. |
WP_Customize_Widgets::print_scripts()wp-includes/class-wp-customize-widgets.php | Calls admin_print_scripts-widgets.php and admin_print_scripts hooks to allow custom scripts from plugins. |
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Migrate from Codex:
Basic Examples:
Result:
<script type=’text/javascript’>
var pluginUrl = “https://website.com/wp-content/plugins/my_plugin/”;
</script>
Note that we use wp_json_encode() to prepare the value for pluginURL before embedding it in the JavaScript code. It is important to always use wp_json_encode() when passing values from PHP to JavaScript, to avoid the possibility of XSS security vulnerabilities.