WordPress saving customization when updating plugin

I’ve made some changes to the contact form 7 plugin for wordpress in the scripts.js file.

They are regarding
$.fn.wpcf7InitForm -> beforeSubmit
$.fn.wpcf7AjaxLoader -> var loader
$.fn.wpcf7NotValidTip with focus coding

Read More

What is the best practice for keeping these changes? Once I update the plugin it will overwrite everything I re-written.

From what I can tell, the only way would be to save my new scripts.js file in e.g. [my theme folder]->assets->js->wpcf7->scripts.js Then deregister the original file and register my new one and enqueue it in my themes functions.php.

Is there a better way? Is there a way to affect just the parts I’ve changed, or do I have to register the entire new scripts.js file (i.e. deregister original and register the new file VS. just appending what I’ve changed in a new file somehow)?

Related posts