What Is Wp-config.php in WordPress

WordPress Wp-config.php is also known as WordPress configuration file used to set up a database connection. Moreover, it has a lot of features and opportunities for optimization.

In accordance with the WordPress codex, this file is one of the most important files in your WordPress installation. Without it, your WordPress website couldn’t function. Consequently, it is found in your WordPress root directory and has a lot of information like database connection data, username, password, etc.

Further on it allow WordPress to communicate with the database to save and restore data such as user, posts, settings, etc. Probably, it is not a part of WordPress shipped file. If you download the WordPress platform, you can find this file only in wp-config-sample.php.

During the installation process, the WordPress will create a final config file based on your given information. At the same time, you can rename this file to wp-config.php to set up your environment.

Furthermore, this file provides the basic configuration details for your WordPress website.

The wp-config.php file contains important information to make your WordPress website operate, including MySQL database connection settings, WordPress salts & keys, WordPress database table prefix, WordPress language and ABSPATH (the absolute path) to the WordPress directory.

WordPress stores your database information in a file called wp-config.php. This file is usually located in the document root directory of your domain name.

For example, if you have WordPress installed on your primary domain the wp-config.php file will be located in the public_html directory of your hosting account.

Following code displays the most important part of the wp-config file:

//MySQL settings – You can get this info from your web host 

// The name of the database for WordPress 

define(‘DB_NAME’, ‘database_name_here’);

//MySQL database username 

define(‘DB_USER’, ‘username_here’);

//MySQL database password 

define(‘DB_PASSWORD’, ‘password_here’);

//MySQL hostname 

define(‘DB_HOST’, ‘localhost’);

The rest of the WordPress wp-config file that is given below also has more and more advanced settings for configuring other database elements, security keys for your WordPress installation and developer options.

//Database Charset to use in creating database tables. 

define(‘DB_CHARSET’, ‘utf8’);

//The Database Collate type. Don’t change this if in doubt.

define(‘DB_COLLATE’, ”);


// Authentication Unique Keys and Salts.


//Change these to different unique phrases!

//You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}

//You can change these at any point in time to invalidate all existing cookies. So this will force all users to have to log in again.


//@since 2.6.0


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’);



//WordPress Database Table prefix.


//Above all you can have multiple installations in one database if you give each a unique

// prefix. Only numbers, letters, and underscores please!


$table_prefix = ‘wp_’;


//WordPress Localized Language defaults to English.


//Change this to localize WordPress. A corresponding MO file for the chosen

//language must be installed to wp-content/languages. For example, install

//de_DE.mo to wp-content/languages and set WPLANG to ‘de_DE’ to enable German

//language support.


define(‘WPLANG’, ”);


//For developers: WordPress debugging mode.


//Change this to true to enable the display of notices during development.

//It is strongly recommended that plugin and theme developers use WP_DEBUG

//in their development environments.


define(‘WP_DEBUG’, false);

// That’s all, stop editing! Happy blogging. 

//Hence, Absolute path to the WordPress directory. 

if ( !defined(‘ABSPATH’) )

define(‘ABSPATH’, dirname(__FILE__) . ‘/’);

//Sets up WordPress vars and included files.

require_once(ABSPATH . ‘wp-settings.php’);

How to  edit the wp-config.php file in WordPress

You can view and edit the file using File Manager in cPanel or via FTP.

Remember that do not edit this file in Google Docs, Wordpad, notepad etc.

Go to the file manager and click the right click on wp-config.php and choose edit. In the edit dialog box click the “edit” button.


Thereafter, Open the file in File Manager editor. Hence, here you can edit your wp-config.php file.

Furthermore always remember that by default WordPress wp-config file includes MySQL settings and authentication keys and salts. Its depend on how you have configured your site.

Leave a Reply