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 pathname you like.

For example, your current wp-content path may look like this: You can customize it to 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.

John Darrel

I am a WordPress Developer and I love creating plugins and themes for WordPress. It is a great CMS for any kind of business but we need to keep it a safe place.

I have over 15 years of experience in building plugins and themes for WordPress and other platforms.

Contact me if you have plugins that you want me to check before you insert them into your website. I will be happy to check them for security and speed.

One thought on “Customize the WP-Content Directory in WordPress

  1. judi bola says:

    Great blog here! Also your web site loads up fast! What host are you using?
    Can I get your affiliate link to your host? I wish my web site loaded up as
    fast as yours lol

Comments are closed.