Some time we need to require a premium/free plugin needs to override the javascript file. So, How can we WordPress override parent theme js. How to remove the script from WordPress. This code through we can easily old WordPress dequeue jquery and override javascript file into child-theme.
The following code will help you override the javascript file in WordPress.
function awaysome_script(){
wp_dequeue_script(‘awaysome-script’);
wp_enqueue_script( ‘awaysome-script’, get_bloginfo( ‘stylesheet_directory’ ). ‘/assets/custom.js’ , array( ‘jquery’ ), false, true );
}
add_action( ‘wp_enqueue_scripts’, ‘awaysome_script’,1 );