The use of WordPress hooks enables you do create a plugin to handle a particular event that occurs within the WordPress system. However, no matter how many hooks are defined, it is hard for the developers to figure out what might be needed in future but for most of the common functionality, you can bet there is a hook available.
For example, if your host does not provide a reliable SMTP service for sending out email, you can create a plugin that uses the ‘wp_mail’ hook to keep a copy of all the outgoing email within a database table so you don’t lose the messages. Another example is the set of plugins that help customize your WordPress login screen – they use something like “add_action( ‘login_head’, ‘custom_login’ );” to tap into the ‘login_head’ hook and inject something into the WordPress login page for adding CSS styling with a ‘wp_print_styles’ function call.
The number of hooks in WordPress increase with each release. The current version, WordPress 3.3 has 1519 hooks. Yes, that is a large number and it would create processing overhead but flexibility is what the WordPress community places a higher value on. If you compare that to WordPress 2.6, which was around about 3 years ago, all we had back then were 724 hooks. Or look back at version 3.0, which has 1344 hooks.
If you can’t find a WordPress hook for what you are looking for, perhaps you can post it as an idea to the WordPress Ideas database. If you don’t know whether WordPress has a particular hook, you can look it up in a WordPress Hooks Database. With an active user community and lots of feature requests, there’s bound to be new hooks being added into newer versions of WordPress.
No comments yet.