Change wp-content paths on WordPress
It’s possible to change the name and location of WordPress’s wp-content folder by making changes to your file structure and wp-config.php file. The wp-content folder holds all themes, uploads and plugins. You may want to do this to hide the fact the site is using WordPress or you may just want to tidy up the URLs in the source code.
Here’s how it’s done:
-
Take a full backup
Incorrect changes can leave your site inaccessible so remember to take a full site back up before making any changes.
-
Change the directory name
Once you have a backup you can then give the wp-content folder a new name. You can either do this via FTP or via the File Manager option from the hosting control panel – please be aware that this change will temporarily bring the site down.
-
Let WordPress know about the change
To let WordPress know about the new directory you need to add the below lines to your wp-config.php file – replace new-name for the directory name you gave in step 2.
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/new-name' ); define( 'WP_CONTENT_URL', '//' . $_SERVER['SERVER_NAME'] . '/new-name' );
-
The new directory will now be live
WordPress will now use the renamed directory as the content folder.
-
Change plugin folder too?
It’s also possible to change the name of the plugin folder which sits in the content folder. To do this take the same steps but the two lines of code are slightly different which are below – replace new-name for the new plugin directory name given
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/new-name' ); define( 'WP_PLUGIN_URL', '//' . $_SERVER['SERVER_NAME'] . '/new-name' );