What is the Event Management System?
Lab: WordPress Plugin API – Introduction & Registering Event Hooks
Video Runtime: 13:16
What is the Event Management System within the Plugin API? It is the system that allows you and I, as developers, to extend, customize, and enhance the website and user experience (UX). It allows you to register your code to specific events and then get called for your code to do its thang.
#WordPress lets us hook our code into Core, plugins, & the theme to let it run when an event runs Share on XWordPress provides us the ability to hook into Core, plugins, and the theme in order to run our code when some event occurs.
Think about that. WordPress Core loads and runs in a specific order. It allows the plugins and theme at different points in that sequence. Let’s say you need to run some code to change the main query that WordPress is going to process. You don’t go into WordPress Core and change the code there. No no no. Instead, you register a callback to the event name. Then WordPress fires that event and your callback runs.
Hooks are the means to hook into the web page building sequence. It lets you run your code too.
WordPress provides you with a registration system using add_action
and add_filter
. You are registering your function to say: “Hey, WordPress, run this code too when this event runs.” Your function’s name gets registered into a lookup table that is stored in wp_filter
.
Before you dive into how to use the functions, first you need to understand why. Why do you need an event-driven system? What is it doing? When do you use it? Let’s talk about the big picture in this episode.
Once upon a time, there was a developer... You! This is going to be a good story...
Episodes
Total Lab Runtime: 01:17:56
- 1 What is the Event Management System?free 13:16
- 2 The Difference Between Action & Filterbasic 09:11
- 3 Introducing Filter Eventbasic 10:53
- 4 WordPress Event Lookup Tablebasic 09:00
- 5 WordPress Event Priority Levelbasic 08:21
- 6 Number of Arguments to Pass to the Callbackbasic 10:56
- 7 PHP Argument Lookup Tablepro 09:11
- 8 Let's Look at add_filter in Corepro 07:08