Find Actions And Filters Available In WordPress
When it comes to WordPress development you can pretty much do anything you want, but you will only realise this when you understand how WordPress works and how it's all put together. The two main areas of WordPress development to understand is the difference between actions and filters.
Actions allow you to assign functions to run a certain point in the code, when looking into the WordPress core code you will see functions like do_action( 'action', 'function'). At this point is when you can assign new functions to run. You can assign as many function as this point as you want, WordPress will create a queue for these function and run all of them.
Filters allow you to change the content of a variable at certain points in the code. In the WordPress core code it will run filters using the apply_filters( 'filter', 'function') function. These filters will pass in a number of parameters and will expect a return from these functions. The same with actions you can add as many functions as you want to filters and WordPress will queue these up and run them at the same point in the code.
One problem you get with this system is knowing what actions and filters you can run in WordPress.
Discover what hooks and filters you can use on your version of WordPress with the following web app. You can select what version of WordPress your site is running and see all the hooks, filters, classes, constants, functions and shortcodes you can use.
Learn how to code with Treehouse
- Learn projects with access to 1000+ videos
- Practice live with our Code Challenge Engine
- Get help in our members-only forums
Join the weekly newsletter
Sign up for our newsletter. You'll be updated on new tutorials as they come available.
Subscribe today and get a 50% discount code to Paulund