用于在发布帖子或已发布帖子时更新站点上次更新日期的处理程序。
原型
_update_blog_date_on_post_publish( string $new_status, string $old_status, object $post )
参数
$new_status
(string)
(Required)
新帖子状态
$old_status
(string)
(Required)
旧帖子状态
$post
(object)
(Required)
发布对象
源文件
路径:wp-includes/ms-blogs.php
<?php
...
function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
$post_type_obj = get_post_type_object( $post->post_type );
if ( ! $post_type_obj || ! $post_type_obj->public ) {
return;
}
if ( 'publish' != $new_status && 'publish' != $old_status ) {
return;
}
// Post was freshly published, published post was saved, or published post was unpublished.
wpmu_update_blogs_date();
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/_update_blog_date_on_post_publish/