Skip to Main Content
WordPress® Bible
book

WordPress® Bible

by Aaron Brazell
February 2010
Beginner to intermediate content levelBeginner to intermediate
672 pages
13h 58m
English
Wiley
Content preview from WordPress® Bible

Appendix A. WordPress Hook Reference

IN THIS APPENDIX

  • Using actions

  • Using filters

  • Hook reference: alphabetical listing

  • Hook reference: general uses

WordPress hooks are the lifeblood of WordPress and the developer ecosystem around it. They are what make WordPress truly extendable.

This appendix is a cheat sheet for developers to reference the 800+ hooks that are included in WordPress. You will find an alphabetical list of all hooks in WordPress 2.8 (Table A.1) and a breakdown of rough contexts that the hooks live in (Table A.2). Make sure you refer to the WordPress source code for exact usage.

Note

There is not enough room to cover how all these hooks work and it is expected that you are a developer who is familiar with the hook system and can find the usage in the WordPress code.

Note

Hooks, including multi-argument hooks, are discussed in greater detail in Chapter 5.

Using Actions

Actions are a type of hook that are fired when an event happens. With actions, developers can tie into an action hook with the add_action() function. Likewise, they can remove an already hooked function with remove_action(). The first argument in both of these cases is the hook name and the second is the name of the function being added to or removed from the hook.

In Listing A.1, I demonstrate how to use the add_action() function to attach a function to a hook. This function uses the Bit.ly URL shortener service (http://bit.ly) to create a shortened URL for a post when it is saved and adds it as a custom field called ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WordPress® Bible, Second Edition

WordPress® Bible, Second Edition

Aaron Brazell

Publisher Resources

ISBN: 9780470568132Purchase book