do_action( 'admin_print_footer_scripts' )
Prints any scripts and data queued for the footer.
Description Description
Source Source
Changelog Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
You can use this hook to insert footer javascript to alter dashboard pages,
function admin_footer_js(){ //you should check to make sure this is the page your want to alter first, check if this your custom post edtit page // for example .wp-admin/edit.php?post_type=my-cpt would be your custom post table list page. if(!isset($_GET['post_type']) || false === strpos($_GET['post_type'],'my-cpt') ){ return false; } //get_current_screen() can result in fatal error on some admin pages, hence I use it after a basic check above $screen = get_current_screen(); if ( 'edit' != $screen->base && '' != $screen->action ){ return; } //now we can sure this is our page. echo "<script type='text/javascript'>\n"; echo 'var pluginUrl = ' . wp_json_encode( WP_PLUGIN_URL . '/my_plugin/' ) . ';'; echo "\n</script>"; } add_action( 'admin_print_footer_scripts', 'admin_footer_js' );Expand full source codeCollapse full source code