Control WordPress Revisions with WPMasterToolKit's Revisions Control Module
Revision management in WordPress is essential for maintaining a balance between modification history and site performance. By default, WordPress records an unlimited number of revisions for each post or page, which can quickly overload the database. It's precisely to address this problem that we've developed the Revisions Control in WPMasterToolKit.
This module lets you easily limit the number of revisions saved, either globally for all content types, or individually by content type (articles, pages, etc.).
Which plugin can the "Revisions Control" module replace?
The "Revisions Control" module can replace specialized plug-ins such as WP Revisions Control or Simple Revisions Deletewhile remaining lighter. Being integrated into WPMasterToolKit, it is optimized to load its resources only when you activate it.
Key features of the Revisions Control module
- Global revision management : You can activate a global control to limit the number of revisions on all content types to a defined number.
- Granular control by content type : If you prefer more specific management, you can set separate limits for each type of content that supports revisions.
- Intuitive interface : A sub-page in the administration menu lets you quickly and easily configure your preferences without technical complexity.
- Enhanced performance : By reducing the number of unnecessary revisions, you optimize the size of the database, potentially improving the speed of your site.
How to use the Revisions Control module
Here are the simple steps to take advantage of this feature:
- Activate the : Go to the WPMasterToolKit panel, then activate the module Revisions Control.
- Access the settings menu: Once activated, a new submenu entitled Revisions Control will be available in the WPMasterToolKit settings.
- Set your limits:
- Enable or disable global control. If enabled, specify the maximum number of revisions to keep for all content types.
- If global control is disabled, you can enable control for each content type (such as "articles", "pages") and define a specific number of revisions for each.
- Enable or disable global control. If enabled, specify the maximum number of revisions to keep for all content types.
- Save your settings : Click the save button, and the module will immediately apply your preferences.
Technical documentation: the hooks used
The module uses a key hook to adjust revision behavior in WordPress:
- Filter
wp_revisions_to_keep
This filter is used to dynamically define the number of revisions to keep, according to the settings configured. Here's how it works:- If global control is enabled, the globally defined value is applied.
- If global control is disabled, the value is applied individually according to content type.
Example of code used :
add_filter( 'wp_revisions_to_keep', array( $this, 'limit_revisions' ), 10, 2 );
Why this technical choice?
We decided to use the native filter wp_revisions_to_keep
because it's powerful and integrates directly into the WordPress core. This makes it possible to modify revision behavior without unnecessary overhead, while offering maximum compatibility with other WordPress features. What's more, global and granular settings offer flexibility to suit any use case, whether it's a small site or a large one with many custom content types.
Conclusion
The module Revisions Control is a powerful and flexible solution for efficiently managing revisions in WordPress. By avoiding the accumulation of unnecessary revisions, it helps keep your database optimized, while giving you full control over global and specific settings.
If you're looking to replace several plugins with a lightweight, efficient all-in-one solution, WPMasterToolKit and its module Revisions Control are made for you!