There will be projects where you need to remove a static method’s callback from a 3rd party plugin. How do you find and remove it? You should never edit their code. Why? Because when they do updates, your changes will be overwritten.
Lastly, you have to figure out the timing of when the callback is registered. Why? Because you can’t unregister it until it’s been registered. Doing it too early is a timing mistake and will cause wonky behavior for you. Why? Because it will load the original callback. You didn’t remove it. If that doesn’t make sense, then go read this article.
Your best friend is code, Tonya is making the introductions.
Total Lab Runtime: 01:58:04
- 1 Lab Introductionfree 10:43
- 2 Meet the PHP Callbackpro 15:01
- 3 Object's Method Callbackpro 11:30
- 4 Static Method Callbackpro 13:32
- 5 Registering an Object's Method to a WordPress Event Hookpro 12:32
- 6 Registering a Static Method to a WordPress Event Hookpro 05:09
- 7 Unregistering a Static Method Callbackpro 03:30
- 8 Unregistering an Object's Method Callbackpro 04:49
- 9 3rd Party Object Callbackspro 15:06
- 10 3rd Party Static Callbackspro 08:27
- 11 "Object Not Available" Strategiespro 08:52
- 12 Design Strategypro 03:29
- 13 Wrap it Uppro 05:24