Return to Snippet

Revision: 70548
at April 7, 2016 07:23 by JoshChris

Initial Code
$query = "SELECT COUNT(*), `ID`, `post_title`, `post_content`, `post_parent`, `post_modified`, `post_name` FROM $wpdb->posts WHERE `post_type` = 'revision' AND DATE(`post_modified`) < DATE_SUB(CURDATE(), INTERVAL 30 DAY) GROUP BY `post_parent` HAVING COUNT(*) > 10 ORDER BY COUNT(*) DESC LIMIT 10";

Initial URL

Initial Description
Too many revisions taking up space in your database? Use this script to find which posts have more than 10 - and then you can figure out what to do with them.

Initial Title
Select Wordpress posts by number of revisions

Initial Tags
php, wordpress

Initial Language