注释状态的运行功能已更改

时间:2018-09-04 13:34:05

标签: wordpress

我正在尝试对已批准的注释运行一个函数,但是我尝试过的所有钩子都没有响应

这是其中一个带有钩子的代码

error_log("error log is running from plugin\n");
add_action('transition_comment_status', 'run_on_status_change', 10, 3);
function run_on_status_change($new_status, $old_status, $comment) {
    error_log("plugin msg: comment status changed: \n");
        error_log("comment has been approved: \n");
            error_log("comment old status: ".$old_status);
            error_log("comment new status: ".$new_status);
            error_log("comment data: ".$comment);
}

我也尝试过:

comment_<old_status>_to_<new_status>

http://hookr.io/4.7.4/actions/comment_old_status_to_new_status/

comment_<new_status>_<comment_type>

http://hookr.io/4.7.4/actions/comment_new_status_comment_type/

第一行代码按预期执行,因为它在钩子之外以测试记录器工作正常。 我尝试删除所有插件,结果没有变化 知道为什么我不能触发钩子吗?

0 个答案:

没有答案