Change wp-content with Code

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

First, access the root directory of your WordPress using the File Manager in your web hosting CPanel or an sFTP client. Then, find a file named wp-config.php and open it 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('WP_CONTENT_URL','http://yourdomain.com/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.

Now, you need to physically change the folder “wp-content” into “lib” using the File Manager, and you will need to log in again to your website.

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

Change wp-content with WP Ghost

The easiest way to change both “wp-content” and “wp-includes” paths is to use the 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: domain.com/wp-content/. You can customize it to domain.com/lib using the WP Ghost plugin.

Change core paths

Note! The plugin does not physically change the wp-content directory but uses rewrite rules. If you deactivate the plugin, you don’t have to move the plugins, themes, and uploads back to their original state.