
基于Laravel开发网站实时评论系统
_update_blog_date_on_post_publish ( $new_status, $old_status, $post )
_update_blog_date_on_post_publish: 这个函数在文章发布时更新博客的日期。它被用来确保博客的日期即使在添加新的文章时也保持准确。
当一个文章被发表或已经发表的文章被修改时,更新网站最后更新日期的处理程序。
已经发表的文章被改变时,更新网站最后更新日期的处理程序。
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(); }