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('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 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: 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.
I have over 10 years 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 in your website. I will be happy to check them for security and speed.
Latest posts by John Darrel
- Customize the WP-Content Directory in WordPress - July 16, 2019
- WP-Chatbot plugin by MobileMonkey - May 9, 2019
- Hide My WP Ghost 4.2 is Here With New Security Features - May 9, 2019