If you’re still wondering about the difference between WordPress actions and WordPress filters, Michael Fields posted a very cool explanation in this forum thread called Actions vs. Filters. I think it’s the best explanation of actions and filters I have seen so far, well done Michael, and keep up the good work!
Let’s pretend that WordPress is a Mexican restaurant and we have ordered a taco as illustrated by the following code…
<?php $taco = 'chicken'; ?>
Hat tip to Philip for finding this little two-year old treasure in the forums. If you’re interested in a very detailed article about the internals of actions and filters, check out Gennady’s post called Inside WordPress Actions and Filters.
Has anyone else stumbled across interesting ways of describing WordPress functions and APIs? Feel free to share your links!
Probably not as good, and definitely oversimplified (and written by me):
http://thematosoup.com/development/additional-contact-fields-wordpress-registration-form/
(hope you don’t mind the URL, but it’s out of context posted like this)
Oh hey Slobodan, that’s awesome! Thanks for sharing the link and great analogy with taking the trash out, I love it :)
And thanks for editing the comment to add the quote :)
I remember that I learned a lot from a post on Nathan Rice’s blog, a few years ago:
http://www.nathanrice.net/blog/an-introduction-to-wordpress-action-hooks/
But Michael’s explanation is pretty good!
Thanks for sharing that Jeremy, it does look like a decent explanation of actions and filters. However, the CSS code snippets that use the heredoc syntax will break because of indentation:
Not really related to the topic, but just as a heads up ;)
Thanks for your comment!
I recently drew pictures, which people seemed to grasp (who doesn’t like stick men?): http://wordpress.tv/2012/09/09/kirk-wight-getting-started-with-theme-development/
Oh wow, that looks great Kirk, brilliant explanation through visuals :) Thanks for sharing!
I think the action example could still be better; they should be less related (eg. paint a landscape, order pizza). Next time…