WordPress save_post cannot access post id

add_action('save_post', 'gmc_save_recipe', 10, 2);

function gmc_save_recipe($post_id, $post) {
  //exit($post_id); //blank page
  //$id = get_the_ID();
  //exit($id); //blank page
  //exit(print_r($post)); //WP_Post Object ( [ID] => 288....
  //exit($post->ID //blank page
}

Can anyone tell me why I get a blank page returned for all of these scenarios? I’m expecting it to display the post id.

Related posts

Leave a Reply