Created
March 9, 2017 06:16
-
-
Save hsleonis/b2f25c2a1f6c6670eb371c2faa0dc06d to your computer and use it in GitHub Desktop.
WP remove all revisioons
This file contains hidden or 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 | |
global $wpdb; | |
if ( check_admin_referer( plugin_basename( __FILE__ ) ) ) { | |
$revisions = $wpdb->get_results( | |
"SELECT 'ID' AS revision_id | |
FROM ($wpdb->posts) | |
WHERE 'post_type' = 'revision' | |
ORDER BY 'ID' DESC" | |
); | |
foreach ( $rev as $revision ) { | |
wp_delete_post_revision( $rev->revision_id ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment