Renaming Your WordPress Site’s wp-content Folder

Clean up your URLs! #swag etc etc, you know it.

WordPress is a flexible CMS in that it allows you to easily rename the folder without any hassle. Keeping URLs looking tidy and human readable is great. Sharing links, particularly images, with /wp-content/ in the URL isn’t a big deal for most people, but it’s still nice to have the option to change it. We do so here at Obstance and a couple of WordPress sites we run. We also keep the default folder name on some installations.

Keep in mind that this is probably best done when you have a new WordPress install, as you don’t want to run into problems like broken links and plugin difficulty. I say plugin difficulty because some plugin authors wrongly hard code with wp-content instead of WP_CONTENT_DIR.

Open up that wp-config.php file

Yeah, the one that’s stored in the root directory of WordPress. That one. Open that up and look for these line:

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Just before that, paste this:

/** Change wp-content folder to simply "content" */
define('WP_CONTENT_FOLDERNAME', 'content');
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/');

Change https:// if you do not use SSL (you really should though).¬† Additionally, you can change content to what you’d like the wp-content folder to be called. You could probably use a protocol-relative URL instead of https:// or http://. That’d simply be //.

Annnnd… you’re done.

All done. Now WordPress will have a different folder name for wp-content and everything should function normally. Huzzah!