wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_delete_auto_drafts › WordPress Function
Seit3.4.0
Veraltetn/v
› wp_delete_auto_drafts ( Keine Parameter )
Definiert in: |
|
Codex: |
Deletes auto-drafts for new posts that are > 7 days old.
Ähnliche Funktionen: wp_delete_category, wp_delete_user, wp_delete_term, wp_delete_post, wp_list_authors
Quellcode
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 ); } }