admin管理员组文章数量:1130349
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!
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 meta is not accessible within savepost hook
版权声明:本文标题:Post meta is not accessible within save_post hook 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749077255a2312493.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论