I am having a problem where I want to stop a particular function from executing. This function is located on another plugin which I can’t change the core files so I am wondering if I can stop a specific function from that file from executing?
So for example that function is testFunction(); and I want to stop that later in the code maybe in on document ready…etc.
Thanks!
Is the function public (as opposed to private via a closure)? And, does it need to be operational at all for things to work, or can you chop it out in total and be fine? If the latter, you can replace the function with a new one:
If you want to disable it for a temporary amount of time, you can store the function in a temporary variable, and restore it later:
Or, if you want to be able to toggle it, a slight variation:
And then just set testFunctionEnabled as you need to.