概述
原文地址:http://codex.wordpress.org/Plugin_API/Action_Reference
muplugins_loaded | After must-use plugins are loaded |
registered_taxonomy | For category, post_tag, etc. |
registered_post_type | For post, page, etc. |
plugins_loaded | After active plugins and pluggable functions are loaded |
sanitize_comment_cookies | |
setup_theme | |
load_textdomain | For the default domain |
after_setup_theme | Generally used to initialize theme settings/options. This is the first action hook available to themes, triggered immediately after the active theme'sfunctions.php file is loaded. add_theme_support() should be called here, since the init action hook is too late to add some features. At this stage, the current user is not yet authenticated. |
auth_cookie_malformed | |
auth_cookie_valid | |
set_current_user | |
init | Typically used by plugins to initialize. The current user is already authenticated by this time. |
└─ widgets_init | Used to register sidebars. This is fired at 'init', with a priority of 1. |
register_sidebar | For each sidebar and footer area |
wp_register_sidebar_widget | For each widget |
wp_default_scripts | (ref array) |
wp_default_styles | (ref array) |
admin_bar_init | |
add_admin_bar_menus | |
wp_loaded | After WordPress is fully loaded |
parse_request | Allows manipulation of HTTP request handling (ref array) |
send_headers | Allows customization of HTTP headers (ref array) |
parse_query | After query variables are set (ref array) |
pre_get_posts | Exposes the query-variables object before a query is executed. (ref array) |
posts_selection | |
wp | After WP object is set up (ref array) |
template_redirect | |
get_header | |
wp_enqueue_scripts | |
twentyeleven_enqueue_color_scheme (Specific to Twenty Eleven) | |
wp_head | |
wp_print_styles | |
wp_print_scripts | |
get_search_form | |
loop_start | (ref array) |
the_post | (ref array) Allows modification of the post object immediately after query |
get_template_part_content | Template part for the content |
loop_end | (ref array) |
get_sidebar | |
dynamic_sidebar | |
get_search_form | |
pre_get_comments | (ref array) |
wp_meta | |
get_footer | |
get_sidebar | This 'sidebar' is a footer area |
twentyeleven_credits | (Specific to Twenty Eleven) |
wp_footer | |
wp_print_footer_scripts | |
admin_bar_menu | (ref array) |
wp_before_admin_bar_render | |
wp_after_admin_bar_render | |
shutdown | PHP execution is about to end |
Actions Run During an Admin Page Request
These actions are run when a logged-in user opens the Posts page in Version 3.3.1. This list shows only the first time an action is called, and in many cases no function is hooked to the action. Each admin page has a different list of actions depending upon the purpose of the page and the plugins installed. This list should be viewed as a guide line or approximation, and not a concrete specification.
In these actions, (hookname) depends on the page. For the Posts page it is edit.php, or for a theme's Background page it is appearance_page_custom-background.
Actions are called with the function do_action(), except those marked (ref array), which are called with the function do_action_ref_array().
muplugins_loaded | After must-use plugins are loaded |
registered_taxonomy | For category, post_tag, etc. |
registered_post_type | For post, page, etc. |
plugins_loaded | After active plugins and pluggable functions are loaded |
sanitize_comment_cookies | |
setup_theme | |
load_textdomain | For domain default |
after_setup_theme | At this stage, the current user is not yet authenticated. |
load_textdomain | For domain twentyeleven |
auth_cookie_valid | |
set_current_user | |
init | Typically used by plugins to initialize. The current user is already authenticated by this time. |
└─ widgets_init | Used to register sidebars. This is fired at 'init', with a priority of 1. |
register_sidebar | For each sidebar |
wp_register_sidebar_widget | For each widget |
wp_default_scripts | (ref array) |
wp_default_styles | (ref array) |
admin_bar_init | |
add_admin_bar_menus | |
wp_loaded | After WordPress is fully loaded |
auth_cookie_valid | |
auth_redirect | |
_admin_menu | See also: _user_admin_menu, _network_admin_menu |
admin_menu | See also: user_admin_menu, network_admin_menu |
admin_init | |
current_screen | |
load-(page) | |
send_headers | Where custom HTTP headers can be added |
pre_get_posts | Exposes the query-variables object before a query is executed. (ref array) |
posts_selection | |
wp | After WP object is set up (ref array) |
admin_xml_ns | |
admin_xml_ns | |
admin_enqueue_scripts | |
admin_print_styles-(hookname) | |
admin_print_styles | |
admin_print_scripts-(hookname) | |
admin_print_scripts | |
wp_print_scripts | |
admin_head-(hookname) | |
admin_head | |
adminmenu | |
in_admin_header | |
admin_notices | |
all_admin_notices | |
(hookname) | |
restrict_manage_posts | |
the_post | (ref array) |
pre_user_query | (ref array) |
in_admin_footer | |
admin_footer | |
admin_bar_menu | (ref array) |
wp_before_admin_bar_render | |
wp_after_admin_bar_render | |
admin_print_footer_scripts | |
admin_footer-(hookname) | Admin page footer |
shutdown | PHP execution is about to end |
wp_dashboard_setup | Allows customization of admin Dashboard |
Post, Page, Attachment, and Category Actions (Admin)
-
post_submitbox_misc_actions
- Runs when an editing page gets generated to add some content (eg. fields) to the submit box (where the publish button is shown). No function arguments.
-
add_attachment
- Runs when an attached file is first added to the database. Action function arguments: attachment ID.
-
add_category
- Same as create_category.
-
category_add_form_fields
- Runs when category add form is cerated in admin. Useful to add a field in this form before the submit button
-
category_edit_form
- Runs when category edit form is created in admin. Useful to add a new field to this form
-
clean_post_cache
- Runs when post cache is cleaned. Action function arguments: post ID. See clean_post_cache().
-
create_category
- Runs when a new category is created. Action function arguments: category ID.
-
delete_attachment
- Runs just before an attached file is deleted from the database. Action function arguments: attachment ID. (Prior to version 2.8 this hook was triggered after attachment was deleted.)
-
delete_category
- Runs just after a category is deleted from the database and its corresponding links/posts are updated to remove the category. Action function arguments: category ID.
-
wp_trash_post
- Runs when a post or page is about to be trashed. Action function arguments: post or page ID.
-
trashed_post
- Runs just after a post or page is trashed. Action function arguments: post or page ID.
-
untrash_post
- Runs just before undeletion, when a post or page is restored. Action function arguments: post or page ID.
-
untrashed_post
- Runs just after undeletion, when a post or page is restored. Action function arguments: post or page ID.
-
before_delete_post
- Runs when a post or page is about to be deleted. Comments, attachments and metadata are still available. Action function arguments: post or page ID.
-
delete_post
- Runs when a post or page is about to be deleted. Comments, attachments and metadata are already deleted. Action function arguments: post or page ID.
-
deleted_post
- Runs just after a post or page is deleted. Action function arguments: post or page ID.
-
edit_attachment
- Runs when an attached file is edited/updated to the database. Action function arguments: attachment ID.
-
edit_category
- Runs when a category is updated/edited, including when a post or blogroll link is added/deleted or its categories are updated (which causes the count for the category to update). Action function arguments: category ID.
-
edit_post
- Runs when a post or page is updated/edited, including when a comment is added or updated (which causes the comment count for the post to update). Action function arguments: post or page ID.
-
pre_post_update
- Runs just before a post or page is updated. Action function arguments: post or page ID.
-
post_updated
- Runs after a post or page is updated. Action function arguments: post or page ID, WP_Post object of the post before the update and after the update.
-
transition_post_status
- Runs when any post status transition occurs. Action function arguments: $old_status, $new_status, $postobject. (See also Post Status Transitions.)
-
(old status)_to_(new status)
- Runs when a post changes status from $old_status to $new_status. Action function arguments: $post object. (See also Post Status Transitions.)
-
(status)_(post_type)
- Runs when a post of type $post_type is transitioned to $status from any other status. Action function arguments: post ID, $post object. (See also Post Status Transitions.)
-
publish_post (not deprecated)
- Runs when a post is published, or if it is edited and its status is changed to "published". This action hook conforms to the (status)_(post_type) action hook type. Action function arguments: post ID, $post object. (See also Post Status Transitions.)
-
publish_page
- Runs when a page is published, or if it is edited and its status is changed to "published". This action hook conforms to the (status)_(post_type) action hook type. Action function arguments: post ID, $post object. (See also Post Status Transitions.)
-
publish_phone
- Runs just after a post is added via email. Action function argument: post ID.
-
publish_future_post
- Runs when a future post or page is published. Action function arguments: post ID.
-
save_post
- Runs whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. Action function arguments: post ID and post object. Runs after the data is saved to the database. Note that post ID may reference a post revision and not the last saved post. Use wp_is_post_revision() to get the ID of the real post.
-
updated_postmeta
- Runs when a metadata has been updated.
-
wp_insert_post
- Same as save_post, runs immediately afterwards.
-
xmlrpc_publish_post
- Runs when a post is published via XMLRPC request, or if it is edited via XMLRPC and its status is "published". Action function arguments: post ID.
Comment, Ping, and Trackback Actions
-
comment_closed
- Runs when the post is marked as not allowing comments while trying to display comment entry form. Action function argument: post ID.
-
comment_id_not_found
- Runs when the post ID is not found while trying to display comments or comment entry form. Action function argument: post ID.
-
comment_flood_trigger
- Runs when a comment flood is detected, just before wp_die is called to stop the comment from being accepted. Action function arguments: time of previous comment, time of current comment.
-
comment_(old status)_to_(new status)
- Runs when a comment status transition occurs. Action function arguments: Comment object.
-
comment_on_draft
- Runs when the post is a draft while trying to display a comment entry form or comments. Action function argument: post ID.
-
comment_post
- Runs just after a comment is saved in the database. Action function arguments: comment ID, approval status ("spam", or 0/1 for disapproved/approved).
-
edit_comment
- Runs after a comment is updated/edited in the database. Action function arguments: comment ID.
-
delete_comment
- Runs just before a comment is deleted. Action function arguments: comment ID.
-
deleted_comment
- Runs just after a comment is deleted. Action function arguments: comment ID.
-
trash_comment
- Runs just before a comment is trashed. Action function arguments: comment ID.
-
trashed_comment
- Runs just after a comment is trashed. Action function arguments: comment ID.
-
comment_closed
- Runs when the post is marked as not a spam.
-
pingback_post
- Runs when a ping is added to a post. Action function argument: comment ID.
-
pre_ping
- Runs before a ping is fully processed. Action function arguments: array of the post links to be processed, and the "pung" setting for the post.
-
trackback_post
- Runs when a trackback is added to a post. Action function argument: comment ID.
-
wp_blacklist_check
- Runs to check whether a comment should be blacklisted. Action function arguments: author name, author email, author URL, comment text, author IP address, author's user agent (browser). Your function can execute awp_die to reject the comment, or perhaps modify one of the input arguments so that it will contain one of the blacklist keywords set in the WordPress options.
-
wp_insert_comment
- Runs whenever a comment is created.
-
wp_set_comment_status
- Runs when the status of a comment changes. Action function arguments: comment ID, status string indicating the new status ("delete", "approve", "spam", "hold").
Blogroll Actions
-
add_link
- Runs when a new blogroll link is first added to the database. Action function arguments: link ID.
-
delete_link
- Runs when a blogroll link is deleted. Action function arguments: link ID.
-
edit_link
- Runs when a blogroll link is edited. Action function arguments: link ID.
Feed Actions
-
atom_entry
- Runs just after the entry information has been printed (but before closing the entry tag) for each blog entry in an atom feed.
-
atom_head
- Runs just after the blog information has been printed in an atom feed, just before the first entry.
-
atom_ns
- Runs inside the root XML element for an atom feed (to add namespaces).
-
commentrss2_item
- Runs just after a single comment's information has been printed in a comment feed (but before closing the item tag). Action function arguments: comment ID, post ID.
-
do_feed_(feed)
- Runs when a feed is generated, where feed is the type of feed (rss2, atom, rdf, etc.). Use priority less than 10 to run before printing the feed. Action function argument: true (the feed is for comments) or false(it is for posts).
-
rdf_header
- Runs just after the blog information has been printed in an RDF feed, just before the first entry.
-
rdf_item
- Runs just after the entry information has been printed (but before closing the item tag) for each blog entry in an RDF feed.
-
rdf_ns
- Runs inside the root XML element in an RDF feed (to add namespaces).
-
rss_head
- Runs just after the blog information has been printed in an RSS feed, just before the first entry.
-
rss_item
- Runs just after the entry information has been printed (but before closing the item tag) for each blog entry in an RSS feed.
-
rss2_head
- Runs just after the blog information has been printed in an RSS 2 feed, just before the first entry.
-
rss2_item
- Runs just after the entry information has been printed (but before closing the item tag) for each blog entry in an RSS 2 feed.
-
rss2_ns
- Runs inside the root XML element in an RSS 2 feed (to add namespaces).
Template Actions
-
after_setup_theme
- Runs during a themes initialization. Is generally used to perform basic setup, registration, and init actions for a theme.
-
comment_form
- Runs at the bottom of a comment form rendered by comment_form(), right before the closing </form>. Action function argument: the post ID.
-
do_robots
- Runs when the template file chooser determines that it is a robots.txt request.
-
do_robotstxt
- Runs in the do_robots() function before it prints out the Disallow lists for the robots.txt file.
-
get_footer
- Runs when the template calls the get_footer() function, just before the footer.php template file is loaded.
-
get_header
- Runs when the template calls the get_header() function, just before the header.php template file is loaded.
-
switch_theme
- Runs when the blog's theme is changed. Action function argument: name of the new theme. If used in a theme, it only works if the theme that adds action is the one being disabled.
-
after_switch_theme
- Runs when the blog's theme is changed. Action function argument: name of the new theme. If used in a theme, it only works if the theme that adds action is the one being enabled. Can be used to run certain code when enabling a theme.
-
load-themes.php
- Runs when the theme is activate or deactivate (replace by an other).
-
template_redirect
- Runs before the determination of the template file to be used to display the requested page.
-
wp_footer
- Runs when the template calls the wp_footer() function, generally near the bottom of the blog page.
-
wp_head
- Runs when the template calls the wp_head() function. This hook is generally placed near the top of a page template between <head> and </head>. This hook does not take any parameters.
-
wp_meta
- Runs when the sidebar.php template file calls the wp_meta() function, to allow the plugin to insert content into the sidebar.
-
wp_print_scripts
- Runs just before WordPress prints registered JavaScript scripts into the page header.
Administrative Actions
-
activate_(plugin file name)
- Runs when the plugin is first activated. See Function_Reference/register_activation_hook.
-
activity_box_end
- Runs at the end of the activity box on the admin Dashboard screen.
-
add_category_form_pre
- Runs before the add category form is put on the screen in the admin menus.
-
add_option_(option_name)
- Runs after a WordPress option has been added by the add_option() function. Action function arguments: option name, option value. You must add an action for the specific options that you want to respond to, such as 'add_option_foo' to respond when option "foo" has been added.
-
add_option
- Runs before an option gets added to the database.
-
added_option
- Runs after an an option has been added.
-
admin_head
- Runs in the HTML <head> section of the admin panel.
-
admin_head-(page_hook) or
admin_head-(plugin_page)
- Runs in the HTML <head> section of a specific admin page or the admin panel of a plugin-generated page.
-
admin_init
- Runs at the beginning of every admin page before the page is rendered. See wp-admin/admin.php, wp-admin/admin-post.php, and wp-admin/admin-ajax.php.
-
admin_footer-(plugin_page)
- Runs at the end of the <body> section of the admin panel of a plugin-generated page.
-
admin_post_(action)
- also: admin_post_nopriv_(action) - Runs a handler for an unspecified GET or POST request.
-
admin_footer
- Runs at the end of the admin panel inside the body tag
-
admin_enqueue_scripts
- Runs in the HTML header so a plugin or theme can enqueue JavaScript and CSS to all admin pages.
-
admin_print_scripts
- Runs in the HTML header so a plugin can add JavaScript scripts to all admin pages.
-
admin_print_scripts-(page_hook) or admin_print_scripts-(plugin_page)
- Runs to print JavaScript scripts in the HTML head section of a specific plugin-generated admin page. The (page_hook) is returned when using any of the functions that add plugin menu items to the admin menu: add_management_page(), add_options_page(), etc. Example:
function myplugin_menu() { if ( function_exists('add_management_page') ) { $page = add_management_page( 'myplugin', 'myplugin', 'manage_options', 'myplugin_slug', 'myplugin_admin_page' ); add_action( "admin_print_scripts-$page", 'myplugin_admin_head' ); } }
-
admin_print_styles
- Runs in the HTML header so a plugin can add CSS/Stylesheets to all admin pages.
-
admin_print_styles-(page_hook) or admin_print_style-(plugin_page)
- Runs when styles should be enqueued with wp_enqueue_style() for a particular admin page. Use the return value of a function such as add_submenu_page() to determine the value of (page_hook).
-
check_passwords
- Runs to validate the double-entry of password when creating a new user. Action function arguments: array of login name, first password, second password.
-
dbx_page_advanced
- Runs at the bottom of the "advanced" section on the page editing screen in the admin menus.
-
dbx_page_sidebar
- Runs at the bottom of the sidebar on the page editing screen in the admin menus.
-
dbx_post_advanced
- Runs at the bottom of the "advanced" section on the post editing screen in the admin menus.
-
dbx_post_sidebar
- Runs at the bottom of the sidebar on the post editing screen in the admin menus. Use add_meta_box() in Wordpress 2.5 and higher.
-
deactivate_(plugin file name)
- Runs when a plugin is deactivated.
-
delete_option_(option_name)
- Runs after a WordPress option has been deleted by the delete_option() function. Action function arguments: option name. You must add an action for the specific options that you want to respond to, such as 'delete_option_foo' to respond when option "foo" has been deleted.
-
delete_option
- Runs before an option gets deleted from the database.
-
deleted_option
- Runs after an an option has been deleted.
-
delete_user
- Runs when a user is deleted. Action function arguments: user ID.
-
edit_category_form
- Runs after the add/edit category form is put on the screen (but before the end of the HTML form tag).
-
edit_category_form_pre
- Runs before the edit category form is put on the screen in the admin menus.
-
edit_tag_form
- Runs after the add/edit tag form is put on the screen (but before the end of the HTML form tag).
-
edit_tag_form_pre
- Runs before the edit tag form is put on the screen in the admin menus.
-
edit_form_top
- Runs inside the form before the title on WordPress post edit screen (and Custom Post Types), but after the inital hidden fields (user_ID, action, etc.).
-
edit_form_after_title
- Runs after the title on WordPress post edit screen (and Custom Post Types) but before the built in WordPress content area.
-
edit_form_after_editor
- Runs just after the WordPress post editor but before all other meta boxes. also available in Custom Post Types.
-
edit_form_advanced
- Runs just before the "advanced" section of the post editing form in the admin menus.
-
edit_page_form
- Runs just before the "advanced" section of the page editing form in the admin menus.
-
edit_user_profile
- Runs near the end of the user profile editing screen in the admin menus.
-
load-(page)
- Runs when an administration menu page is loaded. This action is not usually added directly -- see Adding Administration Menus for more details of how to add admin menus. If you do want to use it directly, the return value from add_options_page() and similar functions gives you the "(page)" part of the action name.
-
login_form
- Runs just before the end of the login form.
-
login_head
- Runs just before the end of the HTML head section of the login page.
-
lost_password
- Runs before the "retrieve your password by email" form is printed on the login screen.
-
lostpassword_form
- Runs at the end of the form used to retrieve a user's password by email, to allow a plugin to supply extra fields.
-
lostpassword_post
- runs when the user has requested an email message to retrieve their password, to allow a plugin to modify the PHP $_POST variable before processing.
-
manage_link_custom_column
- Runs when there is an unknown column name for the blogroll managing admin screen. Action function arguments: column name, link ID. See also filter manage_link_columns in the Plugin API/Filter Reference, which adds custom columns.
-
manage_posts_custom_column
- Runs when there is an unknown column name for the managing posts admin screen. Action function arguments: column name, post ID. See also filter manage_posts_columns in the Plugin API/Filter Reference, which adds custom columns. (see Scompt's tutorial for examples and use.)
-
manage_pages_custom_column
- Runs when there is an unknown column name for the managing pages admin screen. Action function arguments: column name, page ID. See also filter manage_pages_columns in the Plugin API/Filter Reference, which adds custom columns.
-
manage_media_custom_column
- Runs when there is an unknown column name for the managing media admin screen. Action function arguments: column name, page ID. See also filter manage_media_columns in the Plugin API/Filter Reference, which adds custom columns.
-
manage_{$post_type}_posts_custom_column
- Runs when there is an unknown column name for the managing custom post type admin screen. Action function arguments: column name, post ID. See also filter manage_${post_type}_posts_columns in the Plugin API/Filter Reference, which adds custom columns for custom post types.
-
password_reset
- Runs before the user's password is reset to a random new password.
-
personal_options_update
- Runs when a user updates personal options from the admin screen.
-
plugins_loaded
- Runs after all plugins have been loaded.
-
profile_personal_options
- Runs at the end of the Personal Options section of the user profile editing screen.
-
profile_update
- Runs when a user's profile is updated. Action function argument: user ID.
-
quick_edit_custom_box
- Runs when there is an unknown column name when creating the quick editor.
-
register_form
- Runs just before the end of the new user registration form.
-
register_post
- Runs before a new user registration request is processed.
-
restrict_manage_posts
- Runs before the list of posts to edit is put on the screen in the admin menus.
-
retrieve_password
- Runs when a user's password is retrieved, to send them a reminder email. Action function argument: login name.
-
set_current_user
- Runs after the user has been changed by the default wp_set_current_user() function. Note thatwp_set_current_user() is also a "pluggable" function, meaning that plugins can override it; see Plugin API).
-
show_user_profile
- Runs near the end of the user profile editing screen.
-
sidebar_admin_page
- Runs after the main content on the widgets admin page.
-
sidebar_admin_setup
- Runs early when editing the widgets displayed in sidebars.
-
simple_edit_form
- Runs at the end of the "simple" post editing form in the admin menus (by default the simple form is used only for bookmarklets -- it doesn't have the "advanced" sections).
-
update_option_(option_name)
- Runs after a WordPress option has been updated by the update_option() function. Action function arguments: old option value, new option value. You must add an action for the specific options that you want to respond to, such as 'update_option_foo' to respond when option "foo" has been updated.
-
update_option
- Runs before an option gets updated to the database.
-
updated_option
- Runs after an option has been updated.
-
upload_files_(tab)
- Runs to print a screen on the upload files admin screen; "tab" is the name of the custom action tab. Define custom tabs using the wp_upload_tabs filter (see Plugin API/Filter Reference).
-
user_new_form
- Runs near the end of the "Add New" user screen. Action function argument: Passes the string "add-existing-user" on multisite or "add-new-user" on single site and for network admins.
-
user_profile_update_errors
- Runs just before updated user details are committed to the database.
-
wpmu_new_user
- Runs when a user's profile is first created in a Multisite environment. Action function argument: user ID. If not in Multisite then use user_register.
-
user_register
- Runs when a user's profile is first created. Action function argument: user ID.
-
welcome_panel
- Allows you to hide the Welcome Panel in the Dashboard. This is also a smart filter, which hides the related Screen Option.
-
wp_ajax_(action)
- also: wp_ajax_nopriv_(action) - Runs to do an unknown type of AJAX request handler.
-
wp_authenticate
- Runs to authenticate a user when they log in. Action function arguments: array with user name and password.
-
wp_login
- Runs when a user logs in.
-
wp_logout
- Runs when a user logs out.
Dashboard "Right Now" Widget Actions
-
right_now_content_table_end
- Adds table rows at the bottom the content column of the Right Now Dashboard widget.
-
right_now_table_end
- Called after displaying the number of Spam comments in the Discussion column of the Right Now Dashboard widget.
-
right_now_discussion_table_end
- Called after displaying the number of Spam comments and after the right_now_table_end action in the Discussion column of the Right Now Dashboard widget.
-
right_now_end
- Called after the current version information is displayed on the Right Now Dashboardwidget. (Note: In v3.4, this is actually rightnow_end. See ticket #21046.)
-
activity_box_end
- Last action called on the Right Now Dashboard widget.
Advanced Actions
This section contains actions related to the queries WordPress uses to figure out what posts to display, the WordPress loop, activating plugins, and other fundamental-level WordPress code.
-
activated_plugin
- Runs any time any plugin is successfully activated
-
add_meta_boxes
- Runs when "edit post" page loads. ( 3.0+)
-
admin_menu
- Runs after the basic admin panel menu structure is in place.
-
network_admin_notices
- Runs after the admin menu is printed to network admin screens.
-
user_admin_notices
- Runs after the admin menu is printed to user admin screens.
-
admin_notices
- Runs after the admin menu is printed to screens that aren't network- or user-admin screens.
-
all_admin_notices
- Runs after the admin menu is printed to all screens.
-
blog_privacy_selector
- Runs after the default blog privacy options are printed on the screen.
-
check_admin_referer
- Runs in the default check_admin_referrer() function after the nonce has been checked for security purposes, to allow a plugin to force WordPress to die for extra security reasons. Note that check_admin_referrer is also a "pluggable" function, meaning that plugins can override it; see Plugin API).
-
check_ajax_referer
- Runs in the default check_ajax_referer() function (which is called when an AJAX request goes to the wp-admin/admin-ajax.php script) after the user's login and password have been successfully validated from cookies, to allow a plugin to force WordPress to die for extra security reasons. Note thatcheck_ajax_referer is also a "pluggable" function, meaning that plugins can override it; see Plugin API).
-
customize_register
- Runs on every request, allowing developers to register new theme options and controls for use with the Theme Customization API (as of Version 3.4).
-
deactivated_plugin
- Runs any time any plugin is successfully de-activated
-
generate_rewrite_rules
- Runs after the rewrite rules are generated. Action function arguments: WP_Rewrite object ($wp_rewrite) by reference. Note that it is easier to use the rewrite_rules_array filter instead of this action, to modify the rewrite rules.
-
init
- Runs after WordPress has finished loading but before any headers are sent. Useful for intercepting $_GET or $_POST triggers.
-
loop_end
- Runs after the last post of the WordPress loop is processed.
-
loop_start
- Runs before the first post of the WordPress loop is processed.
-
network_admin_menu
- Runs when the basic menu structure is prepared for the Network administration page. ( Administration Menus)
-
parse_query
- Runs at the end of query parsing in the main query or any instance of WP_Query, such as query_posts, get_posts, or get_children. Action function arguments: WP_Query object by reference.
-
parse_request
- Runs after the query request is parsed inside the main WordPress function wp. Action function argument: WPobject ($wp) by reference.
-
pre_get_posts
- Runs before a query is executed in the main query or any instance of WP_Query, such as query_posts(), get_posts(), or get_children(). This hook is called after the query variable object is created, but before the query is actually run, and can be used to to alter the primary query before it is run. Also see is_main_query(). Action function arguments: WP_Query object by reference.
-
sanitize_comment_cookies
- Runs after cookies have been read from the HTTP request.
-
send_headers
- Runs after the basic HTTP headers are sent inside the main WordPress function wp(). Action function argument: WP object ($wp) by reference.
-
shutdown
- Runs when the page output is complete.
-
update_(meta_type)_meta
- Runs when a metadata gets saved.
-
updated_(meta_type)_meta
- Runs when a metadata has been updated.
-
upgrader_process_complete
- Runs when the plugin downloader/upgrader class finishes running
-
wp_loaded
- This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
-
wp
- Executes after the query has been parsed and post(s) loaded, but before any template execution, inside the main WordPress function wp(). Useful if you need to have access to post data but can't use templates for output. Action function argument: WP object ($wp) by reference.
Further Reading
- Writing a Plugin - description of how to write a plugin
- Plugin API - article on how to use filters and actions
- Plugin API/Filter Reference - reference list for filter hooks
- Plugin Resources - comprehensive list of plugin-related resources
- WordPress Hooks Database, a database of all WordPress' hooks, showing which version they come from, and linking to the source code spots that use them
- 本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/p/3888612.html,如需转载请自行联系原作者
最后
以上就是开朗发带为你收集整理的wordpress中remove_action、add_action、 do_action()的hook钩子都有哪些的全部内容,希望文章能够帮你解决wordpress中remove_action、add_action、 do_action()的hook钩子都有哪些所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复