How To

Customize wp-content Directory in WordPress

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.

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.

John Darrel

Change Database Prefix in WordPress

Because hackers often use bots to search for security flaws in your website, it is…

12 months

Customize WordPress Uploads Directory

The easiest way to change the default media uploads path is to use the WP…

12 months

WP Ghost and WP Rocket Cache

To hide all CSS and JS you need to follow the steps to Combine the…

12 months

Why is website security important?

https://youtu.be/6ylhojSi-_E In this video, we’ll explore why website security matters and what can happen if…

12 months

Is WordPress Website Easily Hacked?

The security of your WordPress site depends on multiple factors, such as the strength of…

12 months

Setting up Two-Factor Authentication (2FA) for WordPress Using Mobile Apps

When you enable two-factor authentication (2FA) for your WordPress website, it adds an extra layer…

12 months