Wordpress: How to Edit wp-config.php Files

Go Behind the Scenes to Tweak Your WordPress Configuration

A business man working at office
Kohei Hara/Digital Vision/Getty Images

Most of the time, you manage WordPress through the administration pages at

wp-admin/
. For instance, if your site is at
http://example.com
, you go to
http://example.com/wp-admin
, log in as the administrator, and click around. But when you need to edit a configuration file, like
wp-config.php
, the administration pages aren't enough. You'll need other tools.

Make Sure You Can Edit These Files

Not all installations of WordPress will let you edit configuration files. For instance, if you have a free blog on WordPress.com, you cannot edit configuration files.

Generally, to edit configuration files, you need a "self-hosted" WordPress website. That means you have your own copy of the WordPress code running on your own host. Usually, that also means you're paying a monthly or yearly fee to a hosting company.

Use WordPress Admin, If You Can

On the other hand, many files can be edited within the WordPress administration pages.

You can edit the files for a plugin by clicking

Plugins
on the sidebar, then finding the name of the plugin, and clicking
Edit

You can edit theme files by clicking

Appearance
on the sidebar, then
Editor
in the submenu beneath it.

Note: if you've set up a WordPress network, with multiple sites, you'll need to go to the Network dashboard to make these changes. On the Network dashboard, you edit plugins the same way. For themes, the menu entry on the sidebar is

Themes
not
Appearance.

The WordPress dashboard is handy for quick changes, although you should understand a few ideas about editing configuration files.

But not all files are available through the dashboard. Especially the most important configuration file,

wp-config.php
To edit that file, you'll need other tools.

Find the Directory (Folder) Where WordPress Is Installed

The first step is to figure out where your copy of WordPress is installed. Some files, such as

wp-config.php
will be visible in the main WordPress directory. Other files may be in subdirectories within this directory.

How do you find this directory? Whether you use a browser-based file manager, ssh, or FTP, you'll always log in somehow, and be presented with a list of directories (folders) and files.

Usually, WordPress is not installed in one of these directories that you first see when you log in. Generally, it's in a subdirectory, one or two levels down. You'll need to hunt around.

Every host is a little different, so I can't tell you for sure where it is. But

public_html
is a common choice. Often,
public_html
contains all the files that are, well, public to your website. If you see
public_html
look there first.

Within

public_html
, look for a directory like
wp
or
wordpress
Or, the name of your site, like
example.com

Unless you have a huge account, you can probably find the WordPress directory without too much trouble. Just keep clicking around.

When you see

wp-config.php
and a bunch of other
wp-
files, you've found it.

Tools for Editing Configuration Files

You don't need a special "WordPress" tool to edit WordPress configuration files. Like most software configuration files, they're simply plain text. In theory, editing these files should be easy, but you should learn more about the tools and the pitfalls of editing configuration files.