Saturday, October 24, 2026The WordPress PlaygroundFacebookXPinterest
Glossary

wp-config.php

wp-config.php is the main configuration file of a WordPress site. It tells WordPress which database to connect to, and it holds a few settings that control how the whole site behaves.

If this file goes missing or breaks, your site cannot load at all. So, it is worth knowing what it does.

Settings stored in wp-config.php

Here are the main things inside the file:

  • Database details: the database name, username, password and host, saved as DB_NAME, DB_USER, DB_PASSWORD and DB_HOST.
  • Table prefix: by default, every table name starts with wp_.
  • Security keys and salts: long random strings that protect your login cookies.
  • Debug mode: the WP_DEBUG setting, which is off by default.

Think of it as the ID card of your site. WordPress reads it at the very start of every page load.

Where is the wp-config.php file?

The file sits in the root folder of your installation, next to the wp-admin and wp-includes folders. A fresh WordPress download does not include it, only wp-config-sample.php. The installer creates the real file from that sample.

You cannot edit it from the dashboard, so you need FTP or your host's file manager.

How to edit wp-config.php safely

  1. First, connect to your site with FTP or open the file manager.
  2. Next, download a copy of wp-config.php to your computer.
  3. Now, open the file in a plain text editor.
  4. Here, add your new lines above the comment that says That's all, stop editing!
  5. Finally, save the file and reload your site.

For example, these two lines turn off debug mode and disable the built-in theme and plugin file editors:

define( 'WP_DEBUG', false );
define( 'DISALLOW_FILE_EDIT', true );
Warning

This file stores your database password in plain text, so never share it on a forum. One missing semicolon can also take your site down, so keep that backup copy handy.

If you ever see a database connection error, check the details in this file first. Our guide on fixing the error establishing a database connection walks you through it. To learn more about WP_DEBUG, read how to debug in WordPress.

That's all about wp-config.php, the small file that keeps your whole site connected. Do let us know in the comment box below if you have any doubts.