Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Registering an Object’s Method to a WordPress Event Hook
Lab: PHP OOP and WordPress Hooks Basics
Video Runtime: 12:32
Now that you know how to make an object’s method a callback, let’s apply it to registering a method to a WordPress event. You’ll look in WordPress Core where it is using call_user_func_array()
. Therefore, the same syntax rules and approach applies for you register it to a specific event.
You’ll see how the object’s method is registered and added to the WordPress Event Registry, which is stored in $wp_filter
. You’ll see how the key for it includes the object’s ID plus the method name. You’ll see the array is used as $the_['function']
.
Once upon a time, there was a developer... You! This is going to be a good story...
Episodes
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