Useful WordPress Configuration Tricks

Useful WordPress Configuration Tricks

There are some very useful WordPress configuration tricks that most beginners don’t know about. In this article, we will share some of the most useful WordPress configuration tricks that will help you optimize, troubleshoot and secure your WordPress site.

1. Adding Security Keys in WordPress

The default WordPress installation automatically adds security keys to your configuration file. These security keys are used to add an extra security layer to your WordPress login and cookie authentication.

You can always regenerate security keys if you feel someone may be accessing your website without proper authentication. Changing security keys will log out all logged in users.

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' );
define( 'NONCE_SALT',       'put your unique phrase here' );

2. Change WordPress Table Prefix

A typical default WordPress installation adds a wp_ prefix to all WordPress database table names. Some WordPress security experts believe that changing the table prefix can make your WordPress database more secure.

To do that you, need to change the following line in your WordPress configuration.

$table_prefix = 'wp_';

If you are doing this for an existing website, then you will also need to change the table prefix in your WordPress database.

3. Turn on Debugging in WordPress

WordPress comes with a neat debugging feature that allows you to see or hide WordPress errors when in debug mode. To turn this on, you will need to add this rule in your WordPress configuration file.

define( 'WP_DEBUG', true );

You can also turn on debugging while hiding the errors on your website and saving them in a log file instead. To do that, add the following lines to your configuration settings.

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

This will create a debug.log file inside wp-content folder of your website and store all debugging errors and notices inside the log file.

4. Changing Your Site or WordPress Address

Normally, you can set your WordPress and Site URLs from Settings » Generalpage. However, you may not be able to do that if you don’t have access to your WordPress site, seeing redirect errors, or have just moved your site.

In that case, you can change your site and WordPress URLs via wp-config.php file by adding the following lines:

define('WP_HOME', 'http://www.example.com');
define('WP_SITEURL', 'http://www.example.com');

Don’t forget to replace example.com with your own domain name.

6. Override File Permissions

WordPress allows you to override file permissions if your host has restrictive permissions for all user files. Most users do not need this, but it exists for those who need it.

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

7. Increase PHP Memory Limit

Some of the most common WordPress errors are caused by PHP memory exhausted. You can increase the PHP memory limit through wp-config.php file. Simply paste the code below:

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

8. Securing Your WordPress Configuration File

As you can see, the wp-config.php file contains really important WordPress settings. By default it is located in the root WordPress folder, but you can move it. It can be moved outside your public_html directory, so users cannot access it. WordPress knows by default to look in other directories if the files is not found in the WordPress root folder.

You can also add the following code to your .htaccess file to limit access to this file.

We hope this article helped you learn some useful WordPress configuration tricks that you didn’t know.

Additional Reading:

Leave a Comment

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

0 Shares
Tweet
Share
Pin
Share