Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialScott Craig
41,171 PointsCan anybody explain what do_action is and how it differs from add_action?
Hi,
I get that add_action adds your function to be run when the hook fires.
But I can't for the life of me understand from this video or from the documentation what do_action? does and how it's different from add_action
Can anyone explain this?
Thanks,
2 Answers
Micha Krapp
2,228 Pointsdo_action()
is the hook to which you add the functions via add_action()
Micha Krapp
2,228 PointsYes maybe, but it does not only creates the hook it also executes hooks attached to it. Thatβs why the βdo_β
Scott Craig
41,171 PointsScott Craig
41,171 PointsAh, i see,
Thanks Micha.
So do_action should really be called something like add_a_hook / create_hook_here