save_post action not triggering in wordpress template
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.
精彩评论