$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Post meta is not accessible within save_post hook|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Post meta is not accessible within save_post hook

matteradmin10PV0评论

I am using this code to update post meta but it is not working.

function run_when_job_published( $post_id, $post, $update){
   $post_meta = get_post_meta($post_id);
}
add_action('save_post_jobs', 'run_when_job_published', 10, 3);

But here in this function $post_meta is returning an empty array. Actually I want to update one of the meta field during post insertion but I think it is not possible with this hook. I have also tried publish_post hook but in my scenario it is not working. Any suggestion will be much appreciated. Thank you!

Post a comment

comment list (0)

  1. No comments so far