I’m currently creating a plugin that requires me to overwrite one of the WordPress admin panel javascript files. I have recreated the file with the changes, I need to know how to replace the existing file that gets loaded in load_scripts.php (the script needs to be added in the same order).
I was hoping something like this would do the job:
wp_register_script(‘admin-widgets’, WP_PLUGIN_URL. ‘/oak-automated-sidebars/oak-widgets.js’);
wp_enqueue_script(‘admin-widgets’);
But it doesn’t seem to work, the original script is still loaded. Any suggestions?
You need to first deregister the script using wp_deregister_script
then use your code to re-register the script using your own js file:
Hope this Helps