Fires when scripts are printed for all admin pages.
Source
do_action( 'admin_print_scripts' );
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
Fires when scripts are printed for all admin pages.
do_action( 'admin_print_scripts' );
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 = “http://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.