What is WordPress wp-config.php File and How to Edit It?

This time, we’d like to tell you what is WordPress wp-config.php file and how to edit it. Previously, we have already introduced what is PHP.INI file which is the configuration file of PHP. The wp-config.php file 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?

We can consider the wp-config.php as the most critical file for WordPress because in this file you can find the most important information about your website. Database details located in this file, so you can find in wp-config.php database name and other details. The security of this file is the most important thing for WordPress, so never change permissions of this file and if you need to change something in this file, be careful.

Always save the old version of this file and then make changes.

Where to Find wp-config.php File?

By default, wp-config.php or wp-config-sample.php file is located in the main folder of your WordPress website. You can find it in the public_html folder. If the file name is wp-config-sample.php, then after changes you can rename it and set as wp-config.php, there isn’t any difference in this case.

How to Edit wp-config.php File

If you are going to edit this file, then you need to know your website database details(such as name, username, password, hostname). If you didn’t create database yourself and it was an automatic process, you need to ask your hosting company to provide details (also, check our Best WordPress Gallery Plugins List).

You can edit this file(also, other Php files) with Notepad++. Notepad++ is a nice editor for such types of files.

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 (also, check our WordPress Countdown Plugin).

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 the 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 (also, check our WordPress Reservation System).

Summary

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.

Leave a comment