Actions versus Filters

This is another confusing area in the land of WordPress plugins. What exactly is the difference between an action and a filter? Well, even if you've read through the forums and official documentation, the answers there likely left you more confused, so let's get this clarified once and for all.

Actions and filters are simply two different types of events. Remember that WordPress refers to events as "hooks". The difference between them is predicated on how WordPress handles the hook in question. Some hooks are designated as action hooks, others as filter hooks. When you link one of your functions to a filter hook, your function must accept an input and return an output because it is intended to modify or "filter" output. When ...

Get WordPress 3 Plugin Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.