Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

12 Basic WP-Config Tweaks That You Should Know

April 5, 2017

4 Min Read
wordpress wp config
Reading Time: 4 minutes

WP-config.php file is the backbone of the entire WordPress installation. Most importantly, this file saves the values for a database, database users and their passwords, and the host. It has also been used for handling the security and performances of your WordPress websites.

How to Find WP-Config.php?

So, someone may ask this question, “where to find wp-config.php”? The answer is simple, you will not get this file by default instead you get a sample file named as wp-config-sample.php after installation By using this sample file, you can create the actual wp-config.php and then proceed to setup your WordPress website. This is an automatic process, however, when you paste all the WordPress files to your server using FTP and run the installer, it will ask about your database credentials to create the wp-config file automatically on the root.

In this article, I am going to tell you twelve easy tricks related to this wp-config.php file in order to make it more robust. So without further ado, check out the following steps.

  1. How to bypass FTP connection information?
  2. How to enable debugging in WordPress?
  3. How to change site and WordPress URL?
  4. How to increase (or decrease) PHP memory?
  5. How to edit Trash Box timing?
  6. How to disable automatic updates?
  7. How to set autosave intervals?
  8. How to set Database Prefix?
  9. How to Enable Multi-Site Network?
  10. Error Log Configuration
  11. Turn on WordPress Caching
  12. Lockdown wp-config.php

1. How to Bypass FTP Connection Information?

Bypass FTP connection information on plugin installation or WordPress upgrade by adding following line in wp-config.php:

define( 'FS_METHOD', 'direct');

2. How to Enable Debugging in WordPress?

To troubleshoot the issues, we can enable WordPress debugging by adding following lines in wp-config.php:

define(‘WP_DEBUG’, false); // disable debugging mode by default

define(‘WP_DEBUG’, true); // enable debugging mode

The above code will generate a log file in the wp-content directory of your Webroot.

3. How to Change Site and WordPress URL?

Site and WordPress URL can be changed by adding the following lines in wp-config.php:

define('WP_SITEURL', '');
define('WP_HOME', '');

The above code is very useful if you are migrating your site to a new URL because these lines override the values defined in the wp_options table. Another method is to use the SERVER variable, which will set these values dynamically.

define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );

4. How to Increase or Decrease PHP Memory?

This feature is also available in Cloudways managed WordPress hosting Console, but still, it is a big headache for WordPress users. PHP memory can be increased for your WordPress application by adding the following lines:

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

If needed, you can set a maximum memory limit as well using the following code:

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

5. How to Edit Trash Box Timing?

By default, if a user deletes posts, pages, comments, etc., it is sent to Trash box where WordPress automatically deletes them after 30 days. To change this duration, you can add the following line to modify the value of days as per your need. In the following example, we have decreased it to 15 days.

define( 'EMPTY_TRASH_DAYS', 15 );

You can also disable the Trash feature completely by providing 0 (zero) as a value in the above example.

6. How to Disable Automatic Updates?

After the release of WordPress 3.7, Automatic Updates was introduced. By default, minor core releases and translation files are used to update. To disable this feature, use the following lines in wp-config.php:


I recommend disabling security updates is not a good idea, however, It totally depends on you to keep it enable or disable.

In addition, by default, automatic updates do not work with major releases, but you can enable any core updates defining WP_AUTO_UPDATE_CORE as follows:

# Disables all core updates:

define( 'WP_AUTO_UPDATE_CORE', false );

# Enables all core updates, including minor and major:

define( 'WP_AUTO_UPDATE_CORE', true );

7. How to Set Autosave Intervals?

When creating or editing the post, WordPress automatically save revisions of your post. The default value ofthe autosave interval is 60 seconds which can be increased or decreased by adding the following line:

define( 'AUTOSAVE_INTERVAL', 180 );

8. How to Set Database Prefix?

When you are installing WordPress using the wizard, you can see one of the options is to select the Table prefix. That is stored in the wp-config.php file as:

$table_prefix = 'wp_';

I personally recommend that you can use something different wp_ for the safety of your website from hackers.

9. How to Enable Multi-Site Network?

You need to know that, WordPress 3.0 WPMU was merged into WordPress core. If you want to enable multisite functionality then you need to add the following code to your wp-config.php file.

define('WP_ALLOW_MULTISITE', true);

After adding this code, there will be a new page in your wp-admin called “Network” located in Tools > Network. Now, you need to follow the directions on that page to continue the setup of the MU Network.

You can also check out the WordPress Official WPMU.

10. Error Log Configuration

Here is an easy way to enable basic error logging for your WordPress-powered site. Create a file called “php_error.log”, make it server-writable, and place it in the directory of your choice. Then edit the path in the third line of the following code and place into your wp-config.php file:


11. Turn on WordPress Caching

Just add the following code in the wp-config.php file to turn on the WP-Cache.

define('WP_CACHE', true);

12. Lockdown wp-config.php

As we all know that wp-config.php is one of the most important WordPress files. So, why don’t we hide it from hackers? Wp-config is located in the root WordPress folder by default, but you can move it. To save your wp-config file you need to move outside your public_html directory. If your website is running on Apache Web Server, you can add the following directives to the .htaccess file:

<files wp-config.php>
order allow,deny
deny from all

If the website is running on Nginx, you can add the following directive to the configuration file:

location ~* wp-config.php { deny all; }

If you have any other query in your mind do let me know I would love to add to my article. In the meantime just check out our platform while clicking on the Launch Free Server below and make your website 100% faster.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Start Growing with Cloudways Today!

We never compromise on performance, security, and support.

Saud Razzak

Saud is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform. Saud is responsible for creating buzz, spread knowledge, and educate the people about WordPress in the Community around the globe. In his free time, he likes to play cricket and learn new things on the Internet. You can email him at

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!