{"id":9772,"date":"2026-06-07T14:22:56","date_gmt":"2026-06-07T12:22:56","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9772"},"modified":"2026-06-07T14:22:57","modified_gmt":"2026-06-07T12:22:57","slug":"wordpress-optimization-removing-revisions","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/","title":{"rendered":"WordPress Optimization \u2013 Removing Revisions"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">WordPress automatically creates revisions whenever you edit posts, pages, or other content. These revisions act as restore points, allowing you to compare changes and revert to previous versions if necessary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This feature is particularly useful when multiple people manage website content or when you need to recover an earlier version of an article.<\/p>\n\n\n\n<\/div>\n\n<div id=\"mybox-258973613\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">However, on larger websites with frequent content updates, revisions can accumulate quickly and significantly increase the size of the database. Periodically removing old revisions can help reduce database size and improve performance.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Important<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide is intended for users with basic database administration knowledge.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before executing any SQL queries:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a complete database backup.<\/li>\n\n\n\n<li>Verify that you have selected the correct database.<\/li>\n\n\n\n<li>Test your website after performing any cleanup operations.<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Access_phpMyAdmin\" >Access phpMyAdmin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Log_In_to_the_Database\" >Log In to the Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Open_the_SQL_Query_Editor\" >Open the SQL Query Editor<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Remove_WordPress_Revisions\" >Remove WordPress Revisions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#What_Does_This_Query_Do\" >What Does This Query Do?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Benefits_of_Removing_Revisions\" >Benefits of Removing Revisions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Limiting_Future_Revisions\" >Limiting Future Revisions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Alternative_Cleanup_Methods\" >Alternative Cleanup Methods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/wordpress-optimization-removing-revisions\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Access_phpMyAdmin\"><\/span>Access phpMyAdmin<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to the mybox Panel.<\/li>\n\n\n\n<li>Navigate to:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Databases\n<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Click:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>phpMyAdmin\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A new browser tab will open with the database login page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Log_In_to_the_Database\"><\/span>Log In to the Database<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the database credentials assigned to your WordPress website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you do not know the credentials, you can find them in the <code>wp-config.php<\/code> file located in your WordPress installation directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('DB_NAME', 'database_name');\ndefine('DB_USER', 'database_user');\ndefine('DB_PASSWORD', 'database_password');\ndefine('DB_HOST', 'database_host');\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the file is located in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public_html\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Open_the_SQL_Query_Editor\"><\/span>Open the SQL Query Editor<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After logging in:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Select the WordPress database from the left-hand menu.<\/li>\n\n\n\n<li>Click the:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>SQL\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">tab at the top of the page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This will open the query editor where you can execute SQL commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Remove_WordPress_Revisions\"><\/span>Remove WordPress Revisions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Enter the following SQL query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DELETE a,b,c\nFROM wp_posts a\nLEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)\nLEFT JOIN wp_postmeta c ON (a.ID = c.post_id)\nLEFT JOIN wp_term_taxonomy d ON (b.term_taxonomy_id = d.term_taxonomy_id)\nWHERE a.post_type = 'revision'\nAND d.taxonomy != 'link_category';\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Click:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Execute\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">to run the query.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Does_This_Query_Do\"><\/span>What Does This Query Do?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The query removes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Revision entries stored in the <code>wp_posts<\/code> table.<\/li>\n\n\n\n<li>Related metadata stored in the <code>wp_postmeta<\/code> table.<\/li>\n\n\n\n<li>Associated taxonomy relationships stored in the <code>wp_term_relationships<\/code> table.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This helps eliminate unnecessary database records created by WordPress revision history.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Benefits_of_Removing_Revisions\"><\/span>Benefits of Removing Revisions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cleaning old revisions can provide several benefits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reduced database size.<\/li>\n\n\n\n<li>Faster database backups.<\/li>\n\n\n\n<li>Improved database query performance.<\/li>\n\n\n\n<li>Reduced storage consumption.<\/li>\n\n\n\n<li>Easier database maintenance.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These benefits become more noticeable on websites with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Large numbers of posts.<\/li>\n\n\n\n<li>Multiple content editors.<\/li>\n\n\n\n<li>Frequent content updates.<\/li>\n\n\n\n<li>Long operating history.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Limiting_Future_Revisions\"><\/span>Limiting Future Revisions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To prevent excessive revision growth in the future, you can limit the number of revisions WordPress stores.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following line to your <code>wp-config.php<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('WP_POST_REVISIONS', 10);\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This example limits WordPress to storing the 10 most recent revisions for each post.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can adjust the value as needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Alternative_Cleanup_Methods\"><\/span>Alternative Cleanup Methods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer not to work directly with SQL queries, many WordPress optimization plugins include revision cleanup tools, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>WP-Optimize<\/li>\n\n\n\n<li>Advanced Database Cleaner<\/li>\n\n\n\n<li>LiteSpeed Cache<\/li>\n\n\n\n<li>WP Rocket<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">These plugins can safely remove old revisions through the WordPress administration panel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress revisions provide a useful version history for content, but they can significantly increase database size over time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To remove accumulated revisions:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open phpMyAdmin.<\/li>\n\n\n\n<li>Select your WordPress database.<\/li>\n\n\n\n<li>Open the SQL tab.<\/li>\n\n\n\n<li>Execute the revision cleanup query.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Always create a backup before making database changes and verify that your website functions correctly after the cleanup process is complete.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[58],"manual_kb_tag":[4843,4844,389,638,2146,2147,2750,4840,4841,4842],"class_list":["post-9772","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-web-applications-cms","manual_kb_tag-revision-management","manual_kb_tag-content-recovery","manual_kb_tag-database-backup","manual_kb_tag-wp-config-file","manual_kb_tag-phpmyadmin","manual_kb_tag-database-optimization","manual_kb_tag-database-cleanup","manual_kb_tag-wordpress-revisions","manual_kb_tag-revision-cleanup","manual_kb_tag-remove-revisions"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9772\/revisions"}],"predecessor-version":[{"id":9773,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9772\/revisions\/9773"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=9772"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9772"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=9772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}