I am trying to enqueue an edited js file from my child theme and dequeue the original one from the parent. It should be simple, however, the parent theme is calling a function where all enqueues are made. I managed to enqueue it but not to dequeue. In addition, the original enqueue is followed by wp_localize_script()
function.
If I copy the whole function to my child it works, but I am looking for a cleaner and better way to achieve that.
Here is how the original code is set up (Parent Theme):
In function.php this function is called
add_action('wp_enqueue_scripts', 'wpestate_scripts');
The wpestate_scripts
function is found in another file, css_js_include.php
function wpestate_scripts() {
// A bunch of files being enqueued and some variables being assigned
wp_enqueue_script('wpestate_property', trailingslashit( get_stylesheet_directory_uri() ).'js/property.js',array('jquery','wpestate_control'), '1.0', true);
wp_localize_script('wpestate_property', 'property_vars',
array(
// Variables being localized
)
);
}
I have already added wp_dequeue_script('wpestate_property')
and wp_deregister_script('wpestate_property')
to my child function.php
. And it did not work.
Any help is appreciated.