这取决于功能myAction()
正在做。
您的订单如下:
插入定义动作挂钩do_action( \'bp_members_delete_account_after_submit\' );
你可以用
add_action( \'bp_members_delete_account_after_submit\',
\'action_bp_members_delete_account_after_submit\' );
功能
action_bp_members_delete_account_after_submit()
然后添加一个名为
\'myAction\'
并将两个参数作为字符串传递给它
\'arg1\'
和
\'arg2\'
.
但是在上面的代码中没有什么可以“发生”的,除非您有一个连接到myAction
.
add_action( \'myAction\', \'my_function\', 10, 2 );
function my_function( $first_arg, $second_arg ) {
//here, $first_arg would be literally equal to text \'arg1\'
// $second_arg would be literally equal to the text \'arg2\'
//you would do stuff here
}
当然,您可以跳过其中的一部分,在
action_bp_members_delete_account_after_submit()
通过以下方式实现功能:
function action_bp_members_delete_account_after_submit() {
//you would do stuff here,
//no need to make another hook if you are not going to hook things to it
}