Previously, we have already introduced what is PHP.INI file which is the configuration file of PHP. This time, we’d like to tell you what is wp-config.php file which is the most important file for WordPress.
Configuring the settings of WordPress beyond the core installation can be a daunting task for many WordPress users, for the majority of them have no idea where and how to do this modifying task. In fact, there is a WordPress configuration file called wp-config.php available, containing all the basic information about the database of your website in detail. In the following, we have made a comprehensive introduction about this file, as well as how to edit it correctly without breaking the website.
What is wp-config.php File?
This file can be regarded as one of most critical files for WordPress, for it displays and decides all the database configuring details of your WordPress powered website, such as the username, password, and local host. All the codes and information included in wp-config.php influence the DB to store and retrieve data, and modify the website for some advanced options like security precautions, function expanding, performance improvement, and site customization.
Where to Find wp-config.php File?
In fact, there is no wp-config.php file by default. You can only find the wp-config-sample.php file after the installation of WordPress, which is located at the root installation-directory. You can edit this file as required and save with the name of wp-config.php.
How to Edit This File
Before starting editing this file, you firstly need to know the database name, username, password, and host name. You can get the information from your hosting company. If you manage a web server on your own, then you need to save the related information after creating your database and user.
In addition, there is a special note that you can never use the Microsoft Word or other word processors to edit this file, but make use of a professional text editor like Notepad and EditPlus3.
Configure the Basic Settings
Firstly, we’ like to introduce the most basic settings for this configuration file.
Decide the Security Keys
The security keys are used to guarantee a safe and security website running environment. They make the site hard to be accessed and hacked. At present, there are 4 keys available including AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, and NONCE_KEY, along with 4 corresponding salts of AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, and NONCE_SALT that are used to further increase the level of security.
There is no need to remember these keys. You only need to make them as long and complex as possible with some random words, numbers, letters and symbols. In terms of the salts, you can ignore them as WordPress will generate automatically if none are provided.
Set the table_prefix
If you set up multiple WordPress websites in the same database, then you need to configure the value of $table_prefix that is located at the front of your database tables. Note that each installation should have its unique prefix consisting of numbers, letters, and underscores.
Define WordPress URL
The WordPress URL can be defined in WP_SITEURL, deciding the residing location for the core WordPress files. If your domain name is yourdomain.com, then your WordPress needs to be installed in the folder of /public_html/wordpress.
Modify Auto-Save Interval
WordPress has a default function for post revisions. When you edit a post, it will save copies of each edit using Ajax. You can either increase or decrease the intervals between these auto-saves. The default delay is 60 seconds.
In addition, you can also disable this auto-save feature, and decide the maximum number of post revision.
Display Error Message
WordPress doesn’t warn you by default if there is something wrong, but you can make it display an error message and the debug message on the screen by modifying the WP_DEBUG option.
In fact, we have only presented some of the common modifications that are made by the majority of WordPress owners. If you are looking for some advanced options, you can go for this WordPress Codex for more information.