Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_delete_auto_drafts ›

Da3.4.0
Deprecaton/a
wp_delete_auto_drafts ( Nessun parametro )
Definito a:
Codex:

Delete auto-drafts for new posts that are > 7 days old.



Sorgenti

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 );
	}
}