If a Plugin is coded properly, it will:
- Use core-bundled jQuery, and any other core-bundled script, rather than bundling/using custom versions of such scripts
- enqueue its scripts, via
wp_enqueue_script()
, hooked into an appropriate hook, via an explicit function
So, for such a Plugin:
- You won’t need to worry about customizing/overriding core-bundled scripts, since the Theme will be using the core-bundled versions as well
- You can override custom scripts bundled with the Plugin by dequeueing the Plugin’s scripts, and enqueueing your own custom versions
To override a Plugin’s scripts, you have a few options:
- Call
remove_action()
to remove the entire callback that contains thewp_enqueue_script()
calls - Call
wp_dequeue_script()
to prevent the script from being enqueued, followed by awp_enqueue_script()
call to enqueue your own script. - Call
wp_deregister_script()
, followed bywp_register_script()
(with the same script$handle
to allow your own custom version to be registered, and enqueued in place of the Plugin’s version