1

In functions.php of my parent theme, I have these

function karuna_scripts() {

wp_enqueue_script( 'karuna-functions', get_template_directory_uri() . 
'/assets/js/functions.js', array( 'jquery' ), '20160531', true );

}

add_action( 'wp_enqueue_scripts', 'karuna_scripts' );

I am trying to Dequeue 'karuna-functions' in a child theme

// BEGIN DEQUEUE PARENT ACTION

function remove_parentstickyfunctions() {
    wp_dequeue_script('karuna-functions');
}

add_action('wp_enqueue_scripts','remove_parentstickyfunctions');

// END DEQUEUE PARENT ACTION

But I am still getting the sticky menu functionality which I believe is loaded from /assets/js/functions.js of the parent theme.

How do I remove the sticky menu functionality in the child theme?

0

Try increasing the priority of the respective action, otherwise the system will not know what to dequeue:

function remove_parentstickyfunctions() {
    wp_dequeue_script('karuna-functions');
}
add_action('wp_enqueue_scripts','remove_parentstickyfunctions', 20);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.