WordPress Post Revisions Management

NGINX Server Configuration Guide

📋 Overview

This comprehensive guide covers the management of WordPress post revisions on an NGINX server. Post revisions are a built-in WordPress feature that automatically saves versions of your posts and pages as you edit them. While useful for tracking changes, they can impact database performance and size over time.

📚 Reference: For detailed information about WordPress post revisions, visit the WordPress.org article on revisions.

🎯 Why Disable Post Revisions?

1. Database Size Optimization

Each time you save a post or page revision in WordPress, a new entry is created in the database. Over time, this can lead to a significant increase in database size, especially if you have frequent edits or updates.

Database Growth Over Time

Original Post
Revision 1
Revision 2
Revision N
⚠️ Database Size Increases with Each Revision

Benefits of disabling:

2. Database Performance Enhancement

As the number of post revisions increases, it can impact the performance of database queries. When retrieving content or performing searches, WordPress needs to consider all the revisions associated with a post, which can slow down database queries.

Scenario With Revisions Without Revisions
Database Query Speed Slower (multiple records) Faster (single record)
Storage Space Higher Lower
Content Retrieval More complex queries Streamlined queries
Backup Size Larger Smaller

3. Content Management Considerations

⚠️ Important Considerations:
  • If you rely on the ability to track changes, compare revisions, or revert to previous versions of your content, disabling revisions may not be suitable for your workflow
  • Without a proper backup strategy, you may lose the ability to recover earlier versions of your content
  • Consider your specific content management requirements before making a decision

🔧 Implementation Guide

Prerequisites

Before proceeding, ensure you have:
  • SSH access to your server
  • Sudo privileges
  • WordPress installation directory path
  • A reliable backup system in place

Step-by-Step Process

1System Maintenance Check

After logging into your server, check for any pending system updates or required reboots. If you see a message about "system restart required" or "pending kernel upgrade," reboot your server first:

sudo reboot

Wait a few minutes for the server to reboot, then log back in to continue.

2Navigate to WordPress Directory

Change to your WordPress installation directory. Replace example.com with your actual domain name:

cd /var/www/example.com/

3Open wp-config.php File

Use nano or your preferred text editor to open the WordPress configuration file:

sudo nano public_html/wp-config.php

4Add Post Revisions Directive

Scroll down to the section where you add custom directives (usually near the end of the file, before "That's all, stop editing!"). Add the following lines:

/** POST REVISIONS - DISABLE */ define('WP_POST_REVISIONS', false);

Note: The value must be the boolean false, not the string 'false'.

5Save and Exit

In nano, press Ctrl + X, then Y to confirm, and Enter to save the changes.

6Restart PHP-FPM Service

Restart the PHP-FPM service to apply the changes. Adjust the version number (8.3) to match your PHP version:

sudo systemctl restart php8.3-fpm
✅ Configuration Complete!

WordPress post revisions have been successfully disabled. New posts and pages will no longer create revision entries in the database.

📊 Configuration Flow Diagram

Access Server via SSH
Check System Updates
Navigate to WordPress Directory
Edit wp-config.php
Add WP_POST_REVISIONS Directive
Save Configuration File
Restart PHP-FPM Service
Revisions Disabled ✓

🔄 Alternative Configuration Options

Instead of completely disabling post revisions, you can limit the number of revisions stored:

Option 1: Limit Number of Revisions

/** LIMIT POST REVISIONS TO 3 */ define('WP_POST_REVISIONS', 3);

This will keep only the last 3 revisions for each post/page.

Option 2: Enable Revisions (Default Behavior)

/** ENABLE POST REVISIONS */ define('WP_POST_REVISIONS', true);

This explicitly enables revisions (WordPress default behavior).

🛡️ Best Practices

Recommended Practices:
  • Maintain Regular Backups: Implement a reliable backup strategy before disabling revisions
  • Version Control: Consider using Git or another version control system for important content
  • Database Optimization: Regularly optimize your database using tools like WP-Optimize or WP-CLI
  • Monitor Performance: Track database size and query performance after making changes
  • Document Changes: Keep a log of configuration changes for future reference

🔍 Verification

To verify that post revisions are disabled:

  1. Log in to your WordPress admin dashboard
  2. Edit an existing post or create a new one
  3. Make multiple changes and save
  4. Check if the "Revisions" meta box appears in the sidebar (it should not)

❓ Troubleshooting

Issue Solution
Changes not taking effect Ensure you restarted PHP-FPM and cleared any caching plugins
Syntax error in wp-config.php Check for proper semicolons and quotation marks
White screen after changes Restore wp-config.php from backup and check syntax
Permission denied errors Ensure you're using sudo and have proper permissions

📝 Additional Configuration Examples

Complete wp-config.php Custom Directives Section

/* Custom WordPress Configuration */ /** POST REVISIONS - DISABLE */ define('WP_POST_REVISIONS', false); /** MEMORY LIMIT */ define('WP_MEMORY_LIMIT', '256M'); /** DISABLE WP CRON */ define('DISABLE_WP_CRON', true); /** That's all, stop editing! Happy publishing. */

📚 Related Resources

⚠️ Final Reminder:

The decision to disable post revisions depends on your specific needs. Consider the size of your database, the performance impact, and your content management requirements before making a decision. If you choose to disable post revisions, ensure you have a reliable backup system in place to recover content if needed.