[How To] Customize the WP-Content Directory in WordPress

Method #1 – Change wp-content with wp-config.php

This solution is simple, but it involves editing a core WordPress file.

First, access the root directory of your WordPress installation using the File Manager in your web hosting CPanel or using an sFTP client. Then find a file named wp-config.php and open the file to edit.

Then add the following line in the wp-config file at the beginning of the file:

define ('WP_CONTENT_DIR',__DIR__ .'/lib');
define( 'UPLOADS', 'lib/uploads' );

Where lib is the custom name for the wp-content directory. You can change it with any name you want.

custom wp-content directory

Now, you need to physically change the folder wp-content into lib using the File Manager and you will need to re-login to your website.

Note! Changing the /wp-content directory is very important in your way of keeping the hackers’ bots away from injecting scripts into plugins and themes. But this will not fully protect your website from hackers.

You also need to change all the plugins and themes names and restrict access to the old paths.

Method #2 – Use A Plugin

The easiest way to change both wp-content and wp-includes paths is to use the Hide My WP Ghost plugin.

Once installed, this plugin will allow you to easily change the default WordPress directories with any path name you like.

For example, your current wp-content path may look like this: http://yourdomain.com/wp-content/. You can customize it to http://yourdomain.com/lib using this plugin. Same with the other paths.

Note! Keep in mind that this plugin will not physically change the wp-content directory but it will use rewrites rules. You don’t have to move the plugins, themes, and uploads back to what it was if you deactivate the plugin.

You can change the /wp-content and /wp-includes directories from hackers even with the free version of Hide My WP Ghost plugin. In case you want to add extra security, you will need the Hide My WP Ghost plugin. This plugin comes with support in case you need any configuration help.

  • Thank you for the great post.

    I’ve a question regarding some of the security features.

    I understand that I need to change the folder names and directories of my server. But my question is, wouldn’t all of that just be ‘reset’ when a new upgrade for a specific theme I’m using gets released?


    • Hi, the custom folder name will only apply as a security layer and will not physically change the directory name. This way, the upgrades will not be affected by Hide My WP Ghost.

    • The average loading time for Hide My WP is 0.005s which doesn’t affect the loading speed and SEO.
      If you have a cache plugin installed, Hide My WP will load in the cache and doesn’t affect the loading speed at all.

  • Enjoy the Best Movie regarding All Time
    What video do you want in order to watch today? Sniper movies may be required upon your list.
    This is the most exciting shooting battle, where every sniper activity is
    always interesting to be able to watch.

Leave a Reply to AR Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.