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

Leave a Reply

Your email address will not be published. Required fields are marked *

Login


Username
Create an Account!
Password
Forgot Password? (close)

Sign Up


Username
Email
Password
Confirm Password
Want to Login? (close)

Forget Password?


Username or Email
(close)
%d bloggers like this:
SHARE
OR
SUBSCRIBE
To get latest new / tutorial / technology / development information subscribe with us.
ARE YOU READY? GET IT NOW!
Lets Get Updated with latest trends & tutorials!
Your Information will never be shared with any third party.
Ready for latest tutorials & tools !
OR SUBSCRIBE WITH