Home / Tutorials / How to Rename wp-content Folder in WordPress

How to Rename wp-content Folder in WordPress

While working with WordPress, you probably already know that all assets like images, stylesheets, themes, and plugins stored into wp-content directory. But, we can actually rename wp-content folder to something else.

One of the advantages of renaming “wp-content/” is that your website will look less WordPress-ish, while others say that this could even make your site more secure.

Lets see how we can do this.

Rename wp-content Folder in WordPress

Suppose we want to replace ‘wp-content’ to ‘assets’. So we will rename the wp-content folder to assets. Note that after renaming this folder, any activated plugin or theme will be deactivated and will not be listed in their respective pages, since WordPress cannot find them from the default location, wp-content.
Config Modification

We need to make a few modifications to wp-config.php, but, it is better to create a backup of this file before making any change. Just in case something wrong happen, we will be able to restore it with the backup.

First, add the following line before require_once(ABSPATH . 'wp-settings.php');(usually located at the very bottom) to tell WordPress that the wp-content has changed to assets.

Then, add this line below to direct WordPress to the new directory path.
After adding the above line, WordPress will find and list the installed themes and plugins.

But, will notice that the links remain broken.

To fix this issue, add this line to specify the new directory URL.

We are done. Now, all the plugins, themes, and any media that we upload will be stored in our new folder.

Must Note!

There are several plugins and themes that do not follow best practices. They specify “wp-content” as the path and url in their code, instead of defining them dynamically. In such cases, the plugins and themes may not function properly. Furthermore, this will also break links to images that already attached in your posts and that are stored in wp-content.

So, this modification should be taken with caution and, it is better done when you just starting your website. Otherwise, it could ruin your website entirely, and there will be tons of things you have to fix.

About cmadmin

Web Developer & Designer | Android App Developer


Create an Account!
Forgot Password? (close)

Sign Up

Confirm Password
Want to Login? (close)

Forget Password?

Username or Email
To get latest new / tutorial / technology / development information subscribe with us.
Lets Get Updated with latest trends & tutorials!
Your Information will never be shared with any third party.
Ready for latest tutorials & tools !