How To: Rename Wordpress wp-content directory

How To Rename Wordpress wp-content directory

Wordpress is a very popular content management system (CMS) and is used by more than 60% of people who use a CMS and at the same time accounting for 21.9% of all the websites out there.

Some people are fine using wordpress as it is but some people do not want others to know that they are using wordpress. This is the reason why some people might want to rename a few wordpress directories. One of the directories they want to rename is the wp-content directory. So now the question arises, "How to rename Wordpress wp-content directory?"

Let me stop you right there for a moment and tell you some things about the wp-content directory and how things are connected to it. The wp-content directory contains all the themes, plugins, media and caching directories. So renaming this directory has to be performed under utmost caution. If you do not do it in the right, your website can breakdown.

I should also warn you that renaming the wp-content directory will be a bad idea in some scenarios. One such scenario is when you use plugins and themes which do not follow the standard way of fetching the directory names. These plugins and themes hardcode "wp-content" directory name in code and if you happen to change the name of the directory, it would break your website or at least some functionality.

How To rename Wordpress wp-content directory

To successfully rename the wp-content directory and still have a fully functional website, you need to follow the below steps carefully. Do not miss any of the steps.

Steps to rename Wordpress wp-content directory

  • Rename the "wp-content" to "content" (I chose to rename it as content, you can choose any name you want). At this point, if you visit your plugins or theme panel, it will display an error saying files do not exist and since the plugin or theme was deactivated. Lets move to the next step.
  • In this step, we will be editing the wp-config.php file present in the root directory of your wordpress installation. It is better to keep a backup of this file before editing, just in case things get messy. Add the following two lines before "require_once(ABSPATH . 'wp-settings.php');" found in the wp-config.php file:
    define('WP_CONTENT_DIR',ABSPATH . 'content');define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/content');

    The above code will tell wordpress that we are changing the wp-content to content

Congratulations, its done. You have successfully changed the name of wordpress wp-content directory in just two steps.

by Anoop Naik
on 20th April, 2014
last updated 23rd July, 2017