How to make the child theme deregister javascript file in parent theme

Hi, 

I was wondering how I can deregister one of the javascript files in the parent theme and replace it with a custom file. 
I assume it will be similar to this:

function my_custom_js_files() {
// Deregister /js/scripts.js
wp_dequeue_script( 'scripts' );
// Replace with child-scripts.js
wp_enqueue_script('child-scripts', get_stylesheet_directory_uri().'/js/child-scripts.js', array('jquery'), false, true);
}
add_action('wp_enqueue_scripts', 'my_custom_js_files');

The child-scripts.js gets registered properly but I can't seem to take out the scripts.js when I look in the developers tool.
Thanks

Comments

Sign In or Register to comment.