Every time you save a draft or update a post in WordPress, the system stores a complete copy of that revision in your database. While this is helpful for undoing mistakes, having dozens or even hundreds of revisions for a single post can quickly bloat your database, slowing down your website and increasing your backup sizes.

By default, WordPress saves an unlimited number of revisions. However, you can easily restrict this number by adding a single line of code to your website's configuration file right from your hosting dashboard.

Step 1: Locating the wp-config.php File

Your wp-config.php file contains the core settings for your WordPress installation, and it can be edited directly within your hosting account.

  • Log in to your Sternhost cPanel account.

  • Navigate to the Files section and click on File Manager.

  • Open your website's root folder, which is usually named public_html.

  • Scroll down to find the wp-config.php file, right-click on it, and select Edit.

Step 2: Adding the Revision Limit Rule

Once the file editor is open, you will define exactly how many revisions WordPress should keep for each post.

  • Scroll through the code until you find the line that says "That's all, stop editing! Happy publishing."

  • Right above that line, paste the following code: define( 'WP_POST_REVISIONS', 3 );

  • You can change the number '3' to any amount you prefer, but keeping 3 to 5 revisions is usually plenty for most users.

  • Click the Save Changes button in the top right corner.

Why Limiting Revisions is Essential

  • Prevents Database Bloat: It stops your database from filling up with thousands of outdated copies of your articles, keeping your tables lightweight.

  • Faster Editor Performance: When you open a post to edit, WordPress doesn't have to load a massive list of past revisions, making the backend much more responsive.

  • Seamless Integration: This method uses a native WordPress function, meaning it won't conflict with your themes or require you to install another performance plugin.

Hasznosnak találta ezt a választ? 1230 A felhasználók hasznosnak találták ezt (0 Szavazat)