Editing the wp-config file and debugging in WordPress.

The WordPress configuration file is located in the root of your WordPress file directory and contains the website’s base configuration details, such as database connection information. All code is to be added above the: /* That’s all, stop editing! Happy blogging. */

Debugging in WordPress.

Here is an example on debugging code.

// Enable WP_DEBUG mode set to true. Disable set to false.
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

// Enable Debug display so the errors are seen inside the WordPress backend and frontend. Having debug log as false will only write the errors to the log file. 
define( 'WP_DEBUG_DISPLAY', true ); /* or false*/

/* That's all, stop editing! Happy blogging. */

WP DEBUG true turns on the debugging feature.
WP DEBUG LOG shows the errors directly in the backend and frontend of your site, so you can directly see the errors that are happening. To remove the errors fix the problem or remove the DEBUG LOG line from WP Config.

Debugging plugins:
WP Debugging, Query Monitor, Debug Bar and Log Deprecated Notices.

Other debugging resources:
WordPress ‘wp-config.php’ file Generator

Here are some example code that can be added to wp-config.php.

Increasing the memory allocated to PHP.

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Empty trash automatically

Set the number of days and reduce the size of the database.

define('EMPTY_TRASH_DAYS', 15 );

Limit the number of post revisions.

define( 'WP_POST_REVISIONS', 5 );

We might need to repair the database.

If you receive: Error Establishing a Database Connection in WordPress

Add the following code and hopefully that will fix the above error.

define( 'WP_ALLOW_REPAIR', true );

Technumero article.

If you need to disable the Plugin and Theme Editor so the user is not able to make direct adjustments to these areas.

Then add:

define( 'DISALLOW_FILE_EDIT', true );

Associated tutorial: Suggestions on how to fix update errors with WordPress plugins and themes.

To gain a good overview of the wp-config file go to the WordPress documentation: Editing wp-config.php.
To gain additional information on debugging in WordPress: Debugging in WordPress.


Leave a Reply

Your email address will not be published. Required fields are marked *