Editing your wp-config.php file in WordPress

  1. As we will be editing the wp-config.php file using the cPanel File Manager, begin by logging into cPanel. If you already know how to open and edit this file, you can use any text editor you like, and can probably skip this entire section.
  2. Now that you are logged into cPanel, click on the File Manager icon.
  3. Most likely, you will be placed within your public_html directory. If you have WordPress installed on your primary domain, this is exactly where you want to be.If you have WordPress installed on an addon domain, or inside a subdirectory, you will need to then navigate to that location.
  4. You should now see the wp-config.php file. To open and edit it, right-click on it and click on Code Edit. You should now see the contents of your wp-config.php file.

The wp-config.php database settings

// ** 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' );

/** 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', '' );

The wp-config.php authentication keys and salts

The next section you will see in a default wp-config.php file holds authentication keys and salts. These keys allow your WordPress site to determine that a user is genuinely and properly performing an action within your site that has been authorized. Without them, sessions would be unauthenticated and likely exploited. The following is an example:


 * 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. 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' );


The wp-config.php table prefix

If you have ever dug around your WordPress database, you may have noticed that all tables probably start with wp_. This is because WordPress allows a prefix before each table, and defaults with wp_. If you were changing your table prefix in WordPress, this is where you would make that change.

Note: Changing your table prefix in wp-config.php will not change the actual table prefix and will cause errors as WordPress won’t know the correct prefix. Only change this if you have already changed the prefix within your database tables.

 * WordPress Database Table prefix.
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
$table_prefix = 'wp_';

The wp-config.php WordPress debugging setting

The WP_DEBUG setting will allow you to easily display errors on your site if you are debugging your code. It’s a great idea to keep on in your development environment to ensure that all errors are appropriately handled.

 * 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.
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 * @link https://codex.wordpress.org/Debugging_in_WordPress
define( 'WP_DEBUG', false );

Share This Post