WordPress.org

Ready to get started?Download WordPress

Forums

Core Modification to control Page Revsions (6 posts)

  1. ViennaMex
    Member
    Posted 4 years ago #

    I have WP as a content management system with close to 100 pages that are edited by two people every week. What has happened is that the Edit Page function stops working quickly because between the moment-to-moment Saves and the ever present auto-save feature the database gets glutted with REVISIONS. Suddenly a page cannnot be edited because it will simply not load up in the edit view anymore due to a huge string of Page Revisions trying to load up on the individual Edit Page view.

    I have had to go into PHPMyAdmin to manually delete 100's of revisions that prevented pages from being editable in the Control Panel.

    I am surprised that WP out-of-the-box, in the core files, does not yet offer some controls on the Page Revisions feature. Specifically a Delete function that allows on each page revision link a DELETE function next to the Restore function. And a "Delete this Revision" page button at the top of each Revision display page.

    And also an ability to check multiple Revisions for bulk deletion.

    Also a global function to Allow "x" Numbers of Revisions for Pages that automatically deletes the oldest entry to allow the newest entry for say, the last 3 revisions. And a local specific Page option to change the revisions allowed for a specific page.

    And the ability to turn off the Auto-Save function which keeps saving new versions into the database if this Edit Page is left open in the browser.

    Maybe even a 'detect change' feature which suspends the auto-save function until the page has actually been modified in content.

  2. FYI, you can turn off revisions in your wp-config file which will only save the latest auto-save.

    // Turn off Post Revisions without a plugin
    define('WP_POST_REVISIONS', false);

    See: http://codex.wordpress.org/Revision_Management

    As for deleting revisions, there's a plugin that may help: http://wordpress.org/extend/plugins/revision-control/

  3. syncbox
    Member
    Posted 4 years ago #

    Revision Control is a great plugin, too, to echo Ipstenu.

    It allows global control and per page/post control of enabled, disabled and enabled with number of revisions allowed.

    It's the first plugin I install with every WP site... followed by the get custom fields plugin (my true favorite).

  4. ViennaMex
    Member
    Posted 4 years ago #

    I read the Revision_Management page recommended by Ipstenu and although it is difficult from the way it documents the options to tell what you actually WRITE in the wp.config.php file I decided to try just putting the number of revisions I wanted saved inside single quote marks--define('WP_POST_REVISIONS', '2');.

    Just above my addition is this line from the mysql installation so that my change follows:
    define('DB_COLLATE', '');
    define('WP_POST_REVISIONS', '2');

    Thanks to this I don't have to install another plug-in. In action on a Page as I edit it will always save an auto save, as I still use the auto-save BUT the database is not littered with autosaves or previous saved versions. After 3 versions--two intentional saves and one auto-save it evidently erases the oldest saved version and keeps my two last intentional saves and the latest autosave.

    A big relief--now my pages always load in Edit Page view!

    Thanks to Ipstenu! By the way, this is all it took on a Mysql 5, PHP 5 server with WP 2.8.4.

  5. I suspect it would have worked with or without single quotes, but yeah, that's how I do it too :)

    Never do with a core hack what you can do with a plugin, never do with a plugin what you can do in functions.php, never do in functions.php what can be done with ONE LINE in your config ;)

  6. muymalestado
    Member
    Posted 4 years ago #

    Thank you so much for this - and Ipstenu, for the homily at the end, I'll carve that on the mantelpiece.

Topic Closed

This topic has been closed to new replies.

About this Topic