I want to execute a function, myfunction() [hypothetically named], whenever a page is updated in the admin. The function doesn't do anything to the content that is saved—it just runs an unrelated task elsewhere.
I read that the post_updated hook is good to use for this, but I cannot seem to get this code to run:
add_action('post_updated', 'myfunction');
function myfunction() {
// check if this is a page
$id = get_the_id();
if ( is_page($id) ) {
// do stuff here
}
}
I'm sure I'm missing something obvious; do I have to pass in/return parameters ($post_ID, $post_after, $post_before, from what I gather in the Wordpress Hooks Database) for it to work? If I just want the ID, do I still have to pass in/return the other two?