Where and How to Use WordPress Hooks in Objects

You’ve maybe noted that we’ve recently been writing about WordPress and object-oriented programming in PHP a lot. Just last week, Fred published an article about PHP magic methods, especially __construct, and how they work. This week I want to tackle a very common and oft-debated question about WordPress and OOP: when I use WordPress hooks, […]

Read More

Object-Oriented PHP: The __construct() Magic Method

In this article, we tackle an intermediate topic in object-oriented PHP: magic methods, specifically __construct(). Our goal in this article is to explain __construct() itself: of all the magic methods in OO PHP, it’s by far the most important, certainly in a WordPress context. To explain _construct(), though, we first need to explain what magic methods themselves […]

Read More