用法:
<?php?add_action(?$tag,?$function_to_add,?$priority,?$accepted_args?);??>
参数
$tag
(字符串)希望连接到的动作名称(在Plugin API/Action Reference 上查看动作hook列表)
$function_to_add
(回调)希望调用的函数名称。注意: the PHP documentation for the ‘callback’ type中解释的语法均可用。
$priority
函数的重要程度。改变此参数以决定函数与其他函数的调用顺序。默认值为10,因此(例如)将值设为5时函数运行较早,设为12时运行则较晚。
$accepted_args
函数所接受参数的数量。在WordPress 1.5.1及之后版本中,连接的函数可吸收其它在调用do_action() 或 apply_filters()时设置的参数。例如,comment_id_not_found动作将传递任何函数,若该函数将所请求的评论编号连接到该 动作。
原文:http://codex.wordpress.org/Function_Reference/add_action
关于$tag的全部参数http://codex.wordpress.org/Plugin_API/Action_Reference
add_action()函数在wordpress核心文件wp-includes/plugin.php
中。
下面我简单说几句