0

I have my WordPress site. It has one plugin which adds a JavaScript which I don't want to use. I want to remove it from my site using theme.

Tried multiple solutions like added hook in function file to dequeue the script but doesn't work for me.

2
  • You can refer to the wp_dequeue_script function for it. Check out this one - wp_dequeue_script Commented Oct 2, 2022 at 9:21
  • It might help if you could show the code you are using to dequeue.
    – vancoder
    Commented Oct 3, 2022 at 16:01

1 Answer 1

3

You can use the below code with the required changes in the theme's function file.

Refer to the documentation for more info

  add_action( 'wp_enqueue_scripts', 'remove_thrive_appr_main_script' );
  function remove_thrive_appr_main_script() {
      wp_deregister_script( 'handle-of-style' );
  }

Note - 'handle-of-style' = handle of style (You have to replace it with your own one)

I hope this will help you.

3
  • Where to put this one? In function file of the theme or in header file. Commented Oct 2, 2022 at 10:52
  • Add this one to your theme's function file. Commented Oct 2, 2022 at 10:53
  • It is working one. Thank you so much Ashok :) Commented Oct 2, 2022 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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