0
votes

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 advance!

1

1 Answers

0
votes

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.