Registering and unregistering WordPress hook callbacks is different with PHP objects. In this hands-on lab, you’ll learn the syntax, why it’s different, how to register and unregister, as well as strategies to work with other plugins.
What You Will Learn
In this hands-on lab, you will learn techniques of registering and unregistering WordPress hooks (events) within objects. You’ll learn:
- The syntax to register an object and static method callback
- How to unregister a callback within an object as well as a static method
- Strategies to work with 3rd party plugins and their object and static callbacks
In order to do this hands-on lab, you will need to complete the Introduction to PHP OOP for WordPress.
You get WET when you swim. Stay DRY when you code.
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
The best way to learn OOP is to build convert something that you already know from procedural to OOP. That will make the thought processes and methodologies more relatable for you. In Part 4, you will convert the Collapsible Content Plugin from procedural to Object Oriented Programming (OOP).
Check out the PHP Library for more hands-on labs, insights, Docx, and more.