admin管理员组文章数量:1336211
I am hoping to make the published date of my media files always equal the modified date of the post it's attached to.
e.g.
Image 1 (date: 1/1/20 5:00PM) is attached to Post 1 (date: 1/1/20 5:00PM)
Post 1 is updated on 1/2/20 5:00PM > Image 1 updates it's published time in the db to 1/2/20 5:00PM
So far I have this function, and it works for the parent post to make the published time = modified time, but I need it to work on the child post (the image in post_meta db) rather than the parent.
function reset_post_date_wpse_121565($data,$postarr) {
$data['post_date'] = $data['post_modified'];
$data['post_date_gmt'] = $data['post_modified_gmt'];
return $data;
}
add_filter('wp_insert_post_data','reset_post_date_wpse_121565',99,2);
So, how can I make this code above work for updating the published date of the image child post in post_meta?
本文标签: functionsUpdating Media Published Date When Parent Post Is Modified in Wordpress
版权声明:本文标题:functions - Updating Media Published Date When Parent Post Is Modified in Wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742240538a2438803.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论