WordPress 2.x Hooks for Action - Comprehensive List for Plugin and Theme Developers

By Angsuman Chakraborty, Gaea News Network
Tuesday, December 27, 2005

Comprehensive List of WordPress Action Hooks

For WordPress Plugin and Theme Developers by Plugin Developer

This contains all the available action hooks (documented as well as undocumented) for WordPress plugin and theme developers. All available documentation on these hooks have been updated from WordPress Codex.

Source file and line number information is provided to allow you to find more details about the hook. Please maximize your browser for better display.

Note: You may also want to refer WordPress 2.x Filters - Comprehensive List for Plugin and Theme Developers.

No. Action Source File Line
No.
Comments
1 wp_logout wp-login.php 25  
2 lost_password wp-login.php 38  
3 retreive_password wp-login.php 100  
4 retrieve_password wp-login.php 101  
5 password_reset wp-login.php 137  
6 wp_authenticate wp-login.php 189  
7 wp_login wp-login.php 201  
8 rss_head wp-rss.php 22  
9 rss_item wp-rss.php 33  
10 template_redirect wp-includes\template-loader.php 3

No
parameter. Executes before the determination of the template file to be used to display
the requested page. Useful for providing additional templates based on request criteria.
Example (pedagogical, not useful): Redirect all requests to the all.php template file
in the current themes’ directory.

function all_on_one () {
    include(TEMPLATEPATH
. ‘/all.php’);
    exit;
}
add_action(’template_redirect’,
‘all_on_one’);

11 wp_meta wp-includes\template-functions-general.php 59 No
parameter. Executes in the <li>Meta</li> section of the included Theme’s
sidebar.php’s. Useful for insertion of additional content in meta section.
12 mce_options wp-includes\js\tinymce\tiny_mce_gzip.php 144  
13 tinymce_before_init wp-includes\js\tinymce\tiny_mce_gzip.php 150  
14 profile_update wp-includes\registration-functions.php 76  
15 user_register wp-includes\registration-functions.php 78  
16 private_to_published wp-includes\functions-post.php 175 Receives
the post ID as a parameter. Executes when a post is moved from private to published
status.
17 edit_post wp-includes\functions-post.php 178 Receives
the post ID as a parameter. Executes every time a post is edited.
18 publish_post wp-includes\functions-post.php 182 Receives
the post ID as a parameter. Executes when a post is saved and its status is set to
"publish", regardless of its prior setting. NOTE: to add a hook to this
action in 1.2, be sure to specify a priority between 0 and 9. The generic_ping hook
is buggy and prevents any lesser priority hooks from working.
19 save_post wp-includes\functions-post.php 206 Receives
the post ID as a parameter. Executes when a post is saved to the database.
20 wp_insert_post wp-includes\functions-post.php 207  
21 edit_attachment wp-includes\functions-post.php 342  
22 add_attachment wp-includes\functions-post.php 344  
23 delete_attachment wp-includes\functions-post.php 380  
24 delete_post wp-includes\functions-post.php 538 Receives
the post ID as a parameter. Executes whenever a post is deleted.
25 wp_blacklist_check wp-includes\functions-post.php 642  
26 parse_query wp-includes\classes.php 86  
27 parse_query wp-includes\classes.php 238  
28 pre_get_posts wp-includes\classes.php 262  
29 loop_start wp-includes\classes.php 699  
30 loop_end wp-includes\classes.php 706  
31 generate_rewrite_rules wp-includes\classes.php 1323 No
parameter. Executes whenever the rewrite rules are recomputed. To modify the computed
rules, use the filter rewrite_rules_array instead.
32 comment_post wp-includes\comment-functions.php 52 Receives
the comment ID as a parameter. Executes when a comment is added through wp-comments.php.
33 comment_flood_trigger wp-includes\comment-functions.php 126  
34 edit_comment wp-includes\comment-functions.php 191 Receives
the comment ID as a parameter. Executes whenever a comment is edited.
35 delete_comment wp-includes\comment-functions.php 198 Receives
the comment ID as a parameter. Executes when a comment is deleted.
36 wp_set_comment_status wp-includes\comment-functions.php 209 Receives
the comment ID as a parameter. Executes when the comment status changes.
37 pre_ping wp-includes\comment-functions.php 635  
38 wp_set_comment_status wp-includes\comment-functions.php 794  
39 wp_head wp-includes\functions.php 1432 No
parameter. Template tag. Executes in the <head> section. Useful for insertion
of additional content like metatags or javascript.
40 wp_footer wp-includes\functions.php 1436 No
parameter. Template tag. Executes just before the end of the <body> tag.
Useful for insertion of additional content or statistics code like Google Analytics.
41 comment_form wp-content\themes\classic\comments-popup.php 86 Receives
the comment’s post ID as a parameter. Template tag. Executes after displaying the
comment form for a post that allows comments.
42 comment_form wp-content\themes\classic\comments.php 67  
43 comment_form wp-content\themes\default\comments-popup.php 86  
44 comment_form wp-content\themes\default\comments.php 98  
45 rdf_ns wp-rdf.php 21  
46 rdf_header wp-rdf.php 32  
47 rdf_item wp-rdf.php 54  
48 comment_id_not_found wp-comments-post.php 11 Receives
the comment’s post ID as a parameter. Executes when attempting to display the comment
form for a post that does not exist.
49 comment_closed wp-comments-post.php 14 Receives
the comment’s post ID as a parameter. Executes when attempting to display the comment
form for a post that has closed comments.
50 comment_on_draft wp-comments-post.php 17  
51 pingback_post xmlrpc.php 1236 Receives
the comment ID as a parameter. Executes when a comment is added via XMLRPC.
52 publish_phone wp-mail.php 146 Receives
the post ID as a parameter. Executes when a post is added via wp-mail.php.
53 rss2_ns wp-rss2.php 19  
54 rss2_head wp-rss2.php 29  
55 rss2_item wp-rss2.php 52  
56 edit_form_advanced wp-admin\edit-form-advanced.php 216 No
parameter. Executes during the display of the admin panel’s advanced editing page,
just before the <div> is closed that contains the post content textarea. Useful
for inserting additional input fields into the advanced editing form.
57 admin_menu wp-admin\menu.php 57 No
parameter. Executes after the basic admin panel menu structure is in place. Useful
for adding additional menus to the admin panel.
58 admin_head wp-admin\admin-header.php 312 No
parameter. Executes in the <head> section of the admin panel. Useful for insertion
of additional content.
59 personal_options_update wp-admin\profile-update.php 23  
60 activate_ wp-admin\plugins.php 14  
61 deactivate_ wp-admin\plugins.php 21  
62 manage_posts_custom_column wp-admin\edit.php 218  
63 delete_comment wp-admin\post.php 232  
64 check_passwords wp-admin\admin-functions.php 388  
65 check_admin_referer wp-admin\admin-functions.php 971  
66 switch_theme wp-admin\admin-functions.php 1126  
67 switch_theme wp-admin\admin-functions.php 1133  
68 edit_page_form wp-admin\edit-page-form.php 214 No
parameter. Executes inside the <form> tag on the page editing form. Useful for
inserting additional input fields in the page editing form.
69 show_user_profile wp-admin\profile.php 105  
70 profile_personal_options wp-admin\profile.php 114  
71 edit_user_profile wp-admin\user-edit.php 168  
72 activity_box_end wp-admin\index.php 113  
73 admin_footer wp-admin\bookmarklet.php 101 No
parameter. Executes at the end of the admin panel inside the body tag. Useful for
insertion of additional content.
74 edit_category wp-admin\admin-db.php 123  
75 create_category wp-admin\admin-db.php 126  
76 add_category wp-admin\admin-db.php 127  
77 delete_category wp-admin\admin-db.php 175  
78 delete_user wp-admin\admin-db.php 238  
79 edit_link wp-admin\admin-db.php 297  
80 add_link wp-admin\admin-db.php 299  
81 delete_link wp-admin\admin-db.php 323  
82 simple_edit_form wp-admin\edit-form.php 70 No
parameter. Executes during the display of the admin panel’s simple editing page, just
before the <div> is closed that contains the post content textarea. Useful for
inserting additional input fields into the simple editing form.
83 admin_footer wp-admin\admin-footer.php 9  
84 switch_theme wp-admin\themes.php 14 Receives
the name of the current theme as a parameter. Executes when the blog theme is changed.
85 trackback_post wp-trackback.php 95 Receives
the comment ID as a parameter. Executes when a comment is added via trackback.php.
86 atom_ns wp-atom.php 17  
87 atom_head wp-atom.php 25  
88 atom_entry wp-atom.php 42  
89 core_files_loaded wp-settings.php 164  
90 plugins_loaded wp-settings.php 187  
91 shutdown wp-settings.php 222 No
parameter. Executes when the page output is complete.
92 init wp-settings.php 227 Executes
after WordPress has finished loading but before any headers are sent. Useful for intercepting
$_GET or $_POST triggers.
Discussion
May 23, 2008: 10:16 am

Great and excellent article it’s realy helpful. Thanks again.

May 21, 2008: 2:49 pm

Thank you so much, Angsuman! what a great resource! I knew about it from my brother. There\’s a lot of useful info. I\’ll happily share the address of your blog with my friends. Thanks so much! Wish you great success!!!


Richard Lynch
April 13, 2008: 6:55 pm

I’m trying to detect when a post has a category added or deleted, and, so far, failing…

The docs say that edit_category hook will fire when it happens, but that does not seem to work for me…

Other hooks are working fine for me, so I’m pretty sure it’s not me being totally stupid…

Any ideas welcome to wordpress AT l-i-e DOT com

February 4, 2008: 5:00 pm

these blog is really useful for new comers and Excellent resource list.
It´s a very interesting Blog and simple answer of many questions.
Keep up the good work!

November 11, 2007: 7:36 pm

Thank you for this tips and your Blog!, I spent my time effectivelly browsing it!


Wellnessberater
November 10, 2007: 3:20 pm

Thanks for very interesting article. btw.
I really enjoyed reading all of your posts.
It’s interesting to read ideas, and observations from someone else’s
point of view… makes you think more. So please keep up the great work.
Greetings.


Bayerischer Wald
November 10, 2007: 3:17 pm

I think these blog is really useful for new comers and Excellent resource list.
It´s a very interesting Blog and simple answer of many questions.
Keep up the good work!
Thanks it helps me a lot…

October 7, 2007: 5:34 am

I’m having some problems making the table “sort” when the page loads. I want the table column with, say, names to sort itself alphabetically when you look at the page initially, not only when you click.

October 7, 2007: 12:46 am

I just recently joined the DoFollow community on Bumpzee started by Andy Beard. If you haven’t read Andy’s blog, I suggest you check it out and subscribe right away because he has some amazing content and a great perspective on……

April 18, 2007: 6:36 pm

Very good List. Printed and placed in fromt of my desk.

March 7, 2007: 4:55 am

interesting. Heiko from Germany

November 6, 2006: 10:56 am

[...] Wordpress theme hacks Good resource for hacking wordpress templates. Ok it’s not really hacking, designing templates Taragana.com Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages. [...]


Max
October 16, 2006: 2:57 am

Thanks! I used your description and it was very easily for me.
Thanks once again!

January 31, 2006: 12:36 am

[...] To see if I might be able to customize the plugin myself, I started reading up on writing WP plugins. In the Codex, I found out about the plugin API and how it works. Hooks have been defined so that developers can quickly add custom function calls without modifying core WP files. There is a comprehensive list of WordPress 2.x hooks for action. There is an action called activity_box_end that is called at the end of the activity box on the dashboard. I gave this action a try, but it occurs too early in the script. The cjb_dashboard_showcustomcontent function from the plugin renders the RSS feeds, but the action occurs inside of the activity box, causing some undesired results. What I would like is to have the custom feeds rendered after the WP news feeds, perhaps even replacing them. [...]

January 22, 2006: 1:29 pm

[...] - Wiki zur Plugin-API - Wordpress-Doku zum API - Dokumentation von Hooks (Skippy) - Dokumentation von Hooks (Flatearth) - Liste mit Hooks [...]

December 30, 2005: 9:58 am

@Donovan
Search this is Google:
“What’s Not Gonna Work in WordPress 2.0″


Donovan Dillon
December 30, 2005: 1:02 am

Thank you Angsuman. I am new to Wordpress and find your blog to be exceedingly helpful in coming up to speed. This is a bit off-topic, but I have searched for hours and have not found the info I am looking for, so I am posting my question here: Can you point me to a summary of the changes that need to be made to Wordpress 1.5 plugins in order to make them compatible with Wordpress 2.0?

December 28, 2005: 1:27 am

[...] View the list … [...]

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :