Created
July 22, 2017 13:58
-
-
Save sabrina-zeidan/9172bb053945bf2b4e9b9a9200d3d9cc to your computer and use it in GitHub Desktop.
Bulk delete revisions [Wordpress]
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
| function bulk_delete_revisions(){ | |
| $args = array( 'post_type' =>'revision', 'posts_per_page' => -1, 'post_status' => 'any', 'fields' =>'ids'); | |
| $revisions = get_posts( $args ); | |
| foreach ($revisions as $revision) { | |
| wp_delete_post( $revision, true); | |
| } | |
| } | |
| add_action( 'wp_head', 'bulk_delete_revisions' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment