删除大于7天的新帖子的自动草稿。

原型

wp_delete_auto_drafts()

源文件

路径:wp-includes/post.php

<?php
...
function wp_delete_auto_drafts() {
	global $wpdb;
	// Cleanup old auto-drafts more than 7 days old.
	$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
	foreach ( (array) $old_posts as $delete ) {
		// Force delete.
		wp_delete_post( $delete, true );
	}
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wp_delete_auto_drafts/