Support » Fixing WordPress » Limit revisions code not working in wp-config.php file.

  • Resolved davidtleblanc


    I put this in my wp-config.php file to limit the number of revisions, which on some pages was getting very large: define( ‘WP_POST_REVISIONS’, 5 );

    I thought it was working, limiting the number to five. Now it’s not. I did move it to another location inside the config file, but still it’s not limiting the number of posts.

    Any ideas why it’s not working?

Viewing 4 replies - 1 through 4 (of 4 total)
  • That should work just fine. One question, are you seeing more than 5 revisions on posts that were created before adding that line into the config file, or new posts created after?

    Troy, thanks for the reply.

    These were created before adding the code.

    I noticed now that if the cursor hovers over the revisions line in the publish box, it does now note that the site is configured to keep the 5 revisions. I guess it is working.

    Are those revisions still there or is it just noting or listing that I made a certain number of revisions over a course of time and everything from 6+ is now gone?

    I honestly don’t know how the revisions feature takes the limiter into account for posts created before it has been added. But you should be good to go for any new content created.

    If you want to clean out all the revisions from the database and start fresh, there’s 2 ways to do this.

    1. Via phpMyAdmin: if you have experience and knowledge of working in the phpmyadmin environment you can follow these steps

    2. If you are not comfortable with phpmyadmin there are some plugins that can do it. I’m not overly familiar with any of them, as I go the phpmyadmin route, but from a quick search, Better Delete Revisions comes up often

    Note: if you are going to do this via phpmyadmin, I would highly recommend backing up the database, a good habit to have when doing anything to the database. Just in case


    Thanks for the follow up and sorry I am so late responding.

    It limiter seems to work when an update is made. A site I am working on frequently changes its home page. Before the limiter it had 104 revisions. Now it’s down to five.

    Thanks again for the help and follow up.

    Dave LeBlanc

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Limit revisions code not working in wp-config.php file.’ is closed to new replies.