Created
April 16, 2015 11:26
-
-
Save speeddragon/858c5fca2f834900eaea to your computer and use it in GitHub Desktop.
Delete all wordpress trash posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once('wp-config.php'); | |
$trash = get_posts('post_status=trash&numberposts=-1'); | |
echo "Post count: " . count($trash) . "\n"; | |
foreach($trash as $post) { | |
wp_delete_post($post->ID, $bypass_trash = true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment