I needed to modify JavaScript file in WordPress parent theme. In your case, you might want to override JavaScript file in your child theme, or even deactivate JavaScript file altogether.. You stop the theme scripts from running, and replace them with similar scripts in the child theme... Copy JavaScript file from your parent theme into your child theme and make the necessary changes.. The video guide below shows you how to follow those three steps to modify parent JavaScript files in child theme.. The important thing to understand in the call to wp dequeue script is the handle of the script that we want to remove — in this case, parent-script-to-modify.. You'll most find this handle in the call to wp enqueue script that originally enqueued that script., we're setting that script's handle equal to modified-child-script, and that's the handle we'd use to dequeue that script as well ). The mechanism of wp dequeue script for unwanted and untouchable JS code, plus wp enqueue script for the code you do want, works for modifying plugin scripts as well. Happy dequeueing, and wp dequeue script, parent and child themes, lots more, and plugins, check out our learn WordPress development. Now in its updated and expanded Third Edition, it's helped hundreds of happy buyers learn WordPress development the fast, smart, and thorough way...
Read more