Quantcast
Channel: Collins Agbonghama – SitePoint
Viewing all articles
Browse latest Browse all 19

Understanding Namespaces in the WordPress Hook System

$
0
0

Hooks are a fundamental concept for WordPress developers. In previous articles on SitePoint, we’ve learned what hooks are and their importance, the two types of hooks: actions and filters with code examples of how they work, and an alternative way of firing actions and filters events and how to hook static and non-static class methods to actions and filters.

In this article, I will cover how to hook methods of an instantiated class (object) to actions and filters, how to integrate a namespaced class method to a hook, caveats of using namespaces in WordPress hook system and solution to them.

WordPress Hooks and Namespaces

[author_more]

Hooking Object Methods

Assume you were tasked by your employer to build an ad manger plugin for a large news website, to make ad insertion to news content seamless. This is how you might go about building it.

Continue reading %Understanding Namespaces in the WordPress Hook System%


Viewing all articles
Browse latest Browse all 19

Trending Articles