有朋自远方来,不亦乐乎。
wordpress常见的action钩子大全(五)
原创 橘子书  发布于 7个月前 ( 05-07 ) 阅读: 683 次 评论: 2 条 A+

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.

翻译:在管理员界面 添加分类表单 之前

admin_head

原文:Runs in the HTML <head> section of the admin panel.

翻译:在管理面板的HTML <head>段。

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.

翻译:后台内容页或后台插件面板页 <head>段

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.

翻译:在管理面板的<body>段后端插入一个插件页面。

admin_post_(action)

原文:also: admin_post_nopriv_() – 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.

翻译:在HTML标题中运行,所以插件或主题可以将JavaScript和CSS排队到所有管理页面。

admin_print_scripts

原文:Runs in the HTML header so a plugin can add JavaScript scripts to all admin pages.

翻译:在HTML标题中运行,这样插件就可以将JavaScript脚本添加到所有管理页面。

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:

翻译:运行在一个特定的插件HTML头部打印JavaScript脚本生成管理页面。

当使用添加插件菜单项的任何功能返回到管理菜单时返回(page_hook)。

下面是使用add_management_page(), add_options_page()的例子:

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.

翻译:在HTML标题中运行,这样插件可以向所有管理页面添加CSS/样式表。

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).

翻译:当样式与特定的管理页面的wp_enqueue_style() 一起排队时运行。

使用一个函数的返回值,如add_submenu_page()来确定(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.

翻译:在管理菜单 页面 界面的主编辑部分的底部运行。WordPress 2.5 或更高中使用add_meta_box()

dbx_page_sidebar

原文:Runs at the bottom of the sidebar on the page editing screen in the admin menus.

翻译:在管理菜单 页面 界面的侧边栏部分的底部运行。Wordpress 2.5 或更高中使用add_meta_box()

dbx_post_advanced

原文:Runs at the bottom of the “advanced” section on the post editing screen in the admin menus.

注意:WordPress 2.5 或更高中使用add_meta_box()

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.

注意:WordPress 2.5 或更高中使用add_meta_box()

deactivate_(plugin file name)

原文:Runs when a plugin is deactivated.

翻译:当插件被激活时

delete_user

原文:Runs when a user is deleted. Action function arguments: user ID.

翻译:当用户被删除时,参数: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).

翻译:在 添加/编辑类别表单显示后(但是在表单结束标签</form>之前)

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_fields

edit_tag_form_pre

原文:Runs before the edit tag form is put on the screen in the admin menus.

翻译:在编辑表单之前,也可以使用{$taxonomy}_pre_edit_form

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.

翻译:在表单title字段之后

edit_form_after_editor

原文:Runs just after the WordPress post editor but before all other meta boxes. also available in Custom Post Types.

翻译:紧跟在post编辑器之后

edit_form_advanced

原文:Runs just before the “advanced” section of the post editing form in the admin menus.

翻译:在管理菜单中文章编辑框的“advanced”版块前执行此动作函数。

edit_page_form

原文:Runs just before the “advanced” section of the page editing form in the admin menus.

翻译:在管理菜单中页面编辑框的“advanced”版块前执行此动作函数。

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.

翻译:登录页面的head标签之前

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.

翻译:用户请求电子邮件取回密码之前使用插件前修改PHP $ _post变量。

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_media_columns一起使用。过滤钩子添加表格标题,此动作钩子添加值。

如:

dd_filter( 'manage_media_columns', 'wpdaxue_media_column' );
function wpdaxue_media_column( $columns ) {
$columns["media_url"] = "URL";
return $columns;
}
add_action( 'manage_media_custom_column', 'wpdaxue_media_value', 10, 2 );
function wpdaxue_media_value( $column_name, $id ) {
if ( $column_name == "media_url" ) echo '<input type="text" width="100%" onclick="jQuery(this).select();" value="'. wp_get_attachment_url( $id ). '" />';
}

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 that wp_set_current_user() is also a “pluggable” function, meaning that plugins can override it; see Plugin API).

翻译:使用wp_set_current_user()方法改变用户密码后

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.

翻译:被updata_option()更新之后,参数:旧值,新值。(可以用updated_option代替)

如果你要对特殊的选项添加动作,你可以这样使用,例如:更新foo选项时,使用update_option_foo;

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).

翻译:在上传文件管理界面显示一个界面;“tab”是自定义动作的标签名称。默认自定义标签使用wp_upload_tabs过滤钩子定义

user_profile_update_errors

原文:Runs just before updated user details are commited to the database.

翻译:用户信息被清除前

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.

翻译:错误的ajax请求类型时

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.

翻译:用户退出登录

 

Principle Team
龙砚庭官方QQ群,一个坚持强怼的7P成员群!
10人已关注

目前评论:2   其中:访客  1   博主  1

发表评论

莫慌,小狮子正在努力加载评论...
  1. 西枫里博客
    西枫里博客3 ( 2018.05.08 0:24:16 )  沙发

    很强大,要想真正玩转WP得把这些都过一遍才行~