15 Useful WordPress Configuration Tricks That You May Not Know

There are several useful WordPress WordPress wp-config.php Configuration Tricks that you may not know about.

WordPress wp-config.php Configuration Tricks

Even if you consider yourself a true WordPress expert, there are probably a few things you don’t know about it. Although there are plenty of WordPress tips and tricks out there which can improve the performance of your website, it is the configuration of wp-config.php file that makes the biggest difference of them all. According to Graham Black, the following 15 WordPress configuration tricks are all you need to when it comes setting up your WordPress properly. Keep in reading.

Useful WordPress wp-config.php Configuration Tricks

1. Enabling the Debugging

Tackling some of the more serious issues is impossible without a debugger. To enable debugging in WordPress, access the wp-config.php, and add these lines of code:

define('WP_DEBUG', false);
define('WP_DEBUG', true);

This will also create a log file which can be viewed inside the wp-content directory.

2. Accessing the Basic Settings

If the installation has failed in saving the database settings automatically inside the wp-config.php file, you will have to do it yourself. Access your WordPress website via FTP client, rename the wp-config-sample.php file to wp-config-php and edit the following lines of code:

define('DB_NAME', 'database-name');
define('DB_USER', 'database-username');
define('DB_PASSWORD', 'database-password');
define('DB_HOST', 'localhost');

3. Change Security Keys

Although security keys are added during the process of installation, you may want to regenerate them in order to prevent unauthorized access to your website. Change the following lines of code:

define( 'AUTH_KEY',        'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',   'put your unique phrase here' );
define( 'NONCE_KEY',       'put your unique phrase here' );
define( 'AUTH_SALT',       'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );

4. Edit Site and WordPress URL

These can be changed by accessing wp-config.php and entering these lines:

define('WP_HOMEURL', 'your website’s URL');
define('WP_SITEURL', 'your website’s URL');

5. Edit WordPress Table Prefix

The default prefix for database table names in WordPress is wp_. Changing the prefix might boost the security of your database. All you have to do is change this line:

$table_prefix = 'wp_';

6. Change PHP Memory

You can increase or decrease the amount of PHP memory by entering these lines inside the wp-config.php file:

define( 'WP_MEMORY_LIMIT', '64M' );

If you want to set a maximum value, add the following:

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

7. Disable Automatic Updates

To prevent WordPress from updating automatically, change these lines:

define( 'AUTOMATIC_UPDATER_DISABLED', true );

To disable all core updates, change the following code:

define( 'WP_AUTO_UPDATE_CORE', false );

8. Enable WordPress Caching

To improve the performance of your website, you will have the enable caching. Enter the following bit of code to do that:

define('WP_CACHE', true);

9. Change WordPress Trash Settings

Deleted posts are saved for 30 days before they are removed permanently. In order to change the number of days, access the following line of code and enter the desired value:

define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days

You can also turn off recycling by setting the value to zero. Deleted posts will be removed permanently without previous notification.

10. Change File Permissions

If you want to override existing file permissions, change these lines:

define('FS_CHMOD_FILE', 0644);
define('FS_CHMOD_DIR', 0755);

11. Repair Database Automatically

When one of your database tables becomes corrupt, it can cause a huge problem. You may not even be able to log in. To avoid this, add the following line to wp-config.php:

define('WP_ALLOW_REPAIR', true);

Inside your browser, enter this address: {your website’s domain}/wp-admin/maint/repair.php.

The script will run, and after it’s done, you can delete the entry from the file.

12. Change Post Revision Settings

The great thing about WordPress is that saves your posts automatically, plus you can access each of the revisions and revert back to an earlier version of the post. But, you can gain even more control over revisions by accessing the following strings inside the configuration file:

define('AUTOSAVE_INTERVAL', 120);
define('WP_POST_REVISIONS', 10);

Each value is defined in seconds. You can also turn off revisions, but it’s probably a good idea to keep this feature active.

13. Turn on Multisite Network

If you need to have multisite functionality enabled, open the configuration file and add the following line of code:

define('WP_ALLOW_MULTISITE', true);

14. Turning Off Backend File Editing

You’re going to want to do this mainly because of themes and plugins. Just add the following line of code into the configuration file:

define('DISALLOW_FILE_EDIT', TRUE);

15. Lock the Configuration File

As you can see, the wp-config.php file is essential for your website’s security, and you want to prevent others from accessing it. To do this, access the .htaccess file and add this line:

# Protect wp-config.php
order allow,deny
deny from all

Summary

These 15 tips will allow you to fine-tune your WordPress down to every last detail. We hope you found this article helpful. Good luck!

Website & Email Hosting

Get the best website & email hosting for speed, security, and peace of mind. No restrictions. Freedom to do what you need in order to run your business.

Host Now
Comments

No comments yet

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Want More Content Like This?

Want More Content Like This?

Join our newsletter to get more content like this via email!

You'll receive a free, monthly email with a summary of very useful articles. No spam, just great content!

You have Successfully Subscribed!

Pin It on Pinterest