Important Configurations in WordPress Configuration File [wp-config.php]


If you install wordpress, you should have a wp-config.php under the root directory of your wordpress installation folder. This file stores the important details of your database access details. For example,

1
$table_prefix  = 'wp_';
$table_prefix  = 'wp_';

clearly specifies the prefix of the wordpress tables. This file wp-config.php will not be updated if you upgrade WordPress or the themes. It is recommended to set the file mode to 644 which is [Read+Write] of owner, and only [Read] for other groups.

WP_CACHE

This is enabled true by default. You should have this at the top of the file:

1
define('WP_CACHE', TRUE);
define('WP_CACHE', TRUE);

It turns on the cache for wordpress [Object Cache].

WP_POST_REVISIONS

Turning WP_POST_REVISIONS off disallows storing revisions, so the database storage is reduced. Normally there will be multiple copies of the history of the posts/pages. Keeping these copies consume space and should be disabled if you have a limited database space. You should also use SQL to purge the database for these revisions. The following deletes posts from database where they are not published (so maybe drafts, revisions etc).

delete from `wp_posts` where `post_status` <> `publish`

Define this constant as false will safely turn this off.

1
define('WP_POST_REVISIONS', false);
define('WP_POST_REVISIONS', false);

DISABLE_WP_CRON

WordPress has its own cron system, which is checked everytime the page is loaded. It is recommended to turn this off and use a real crontab set up on Linux system.

So, instead of leaving this crontab check to wordpress, why not disable it and set it up using Linux crontab.

1
define('DISABLE_WP_CRON', true);
define('DISABLE_WP_CRON', true);

To set up a real cron for wordpress, please visit this post for more details.

EMPTY_TRASH_DAYS

EMPTY_TRASH_DAYS specifies the date interval that the WordPress will delete posts/comments from the [Trash], which is similar to [Recycle Bin] on Windows.

Setting this to:

1
define('EMPTY_TRASH_DAYS', 15);
define('EMPTY_TRASH_DAYS', 15);

allows system to clean up trash posts/comments every 15 days, while setting this to zero will permanently disable this feature, so you have to manually delete trash yourself.

1
define('EMPTY_TRASH_DAYS', 0);
define('EMPTY_TRASH_DAYS', 0);

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
499 words
Last Post: How to Add Another Comment Form when the Comment Count is Large for WordPress Posts?
Next Post: Code Review: GetTempFileName in C#

The Permanent URL is: Important Configurations in WordPress Configuration File [wp-config.php]

Leave a Reply