WP_ALLOW_REPAIR to repair and optimize the WordPress database

Table of Contents

The WP_ALLOW_REPAIR constant, when used, activates the native WordPress feature to repair corrupted tables in the database. The same feature can also be used to, in addition to repair, optimize tables.

If you are a seasoned professional, with advanced knowledge, prefer the use of tools for database management, or the unshakable terminal.

Using the WP_ALLOW_REPAIR constant

This constant must be placed in the wp-config.php file. Its value must be a true boolean. Like this:

define (‘WP_ALLOW_REPAIR’, true);

Once you have added this setting to the file and obviously saved it, access the following URL:

/wp-admin/maint/repair.php

WP will display the following interface:

WordPress screen when the repair.php file is accessed and the WP_ALLOW_REPAIR constant is active

A simple and explanatory interface with two alternatives: repair the database or repair and optimize the database. The difference between the two is that in the second alternative an optimization will be performed after the repair.

The result will be displayed as follows:

WP_ALLOW_REPAIR WordPress screen displaying result of database repair operation

Delete configuration after use

The database must be repaired, and/or optimized when needed. This must be done by authorized persons. Therefore, after making use of the feature consider removing the

WP_ALLOW_REPAIR constant from the wp-config.php file.

Otherwise, anyone can perform these costly operations on your database and compromise the performance and operation of your application.

The file /wp-admin/maint/repair.php when accessed without the presence of the constant displays the following indicative message to the user:

WordPress screen reporting the need to use the WP_ALLOW_REPAIR constant for resource usage

Make good use of the resource when needed. That is when you need to automatically repair the problems in your WordPress installation database. As well as the need to optimize it.

This native platform feature helps in solving common and simple problems. For simplicity of use, it is a great alternative for people with few database experiences as well as for those even more experienced who need a quick and practical alternative.

Readers note: If your website is slow and you are planning to switch to another Webhost, check out our Fully Managed WordPress Hosting Service that can make your website 30x faster!

Fully Managed WordPress Hosting

Nestify’s AWS powered dedicated CPU servers keep your sites fast, secure, and always up to date.

Want faster WordPress?

WordPress Speed Optimization

Try our AWS powered WordPress hosting for free and see the difference for yourself.

No Credit Card Required.

Whitelabel Web Hosting Portal Demo

Launching WordPress on AWS takes just one minute with Nestify.

Launching WooCommerce on AWS takes just one minute with Nestify.