开发者

save_post action not triggering in wordpress template

开发者 https://www.devze.com 2023-04-05 06:58 出处:网络
I trying to hook a function into save_post like this: function my_function($post_ID) { var_dump($post_ID);

I trying to hook a function into save_post like this:

function my_function($post_ID) {
    var_dump($post_ID);
}
add_action('save_post', 'my_function');

The problem is that it's not doing anything, I'm using the var_dump as example but it should at least print the $post_ID variable when I edit/publish a post.

Am I missing something? Thanks in adv开发者_StackOverflow中文版ance!


Where are you using this? As far as I know, the "save_post" hook is only executed in the admin section, so you won't see anything if you are trying to run this outside of it.

0

精彩评论

暂无评论...
验证码 换一张
取 消