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' );
You can use this hook to insert footer javascript to alter dashboard pages,
Expand full source codeCollapse full source code