-
Greetings! I am Torleif Berger, 24 years old, a Seventh-Day Adventist and currently working as a software developer. Otherwise, not much to tell. Although I do juggle a bit...
-
Async Best practices Big Int Blogging Books C# Collatz conjecture Command line Embedded Resources Events Factorization Fibonacci Genders Hashing Java Latex Mac Math Media Men MySql Nerd Null NUnit Palindromes Plugins Primes Pythagorean triplets Python Sieve of Atkin Sieve of Eratosthenes Snippet Sorting Sql Subversion TDD Threading Tools Triangle Numbers Tutorial Unit-Testing Unix WinForms WordPress YouTube
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
















How to delete WordPress post revisions
Having revisions on my posts is nice I suppose. But I was starting to get a bit annoyed with the increasingly long list of revisions in each post. And they really did get long. Mainly because I am in a bit of a testing and experimenting phase which means that I have done a lost of adjustments to almost every single post so far because I don’t have 100% control on how I want things or how things will end up looking and so on
Anyways, I found a nice little MySQL snippet to clear out all of them in a French comment to a blog post. Thought I could share it here. Especially since I then know where to find it and it won’t disappear on me.
FROM wp_63nbis_posts x
LEFT JOIN wp_63nbis_term_relationships y ON (x.id = y.object_id)
LEFT JOIN wp_63nbis_postmeta z ON (x.id = z.post_id)
WHERE x.post_type = 'revision'
I did a select first (just swap
(All of which are very easy to do in MySQL Query Browser)
delete x,y,zwithselect *) to check that it would delete what it was actually supposed to. And then a delete inside a transaction with another select afterwards, just in caseBy the way, in the comments to that mentioned blog post there are also mentioned some other solutions to this problem. For example:
define('WP_POST_REVISIONS', N);to your wp-config.php file, where N would be the maximum number of revisions you want to allow, or -1 if you want them all.