/ Published in: PHP

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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$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";
Comments
