Normally while installing WordPress, it creates three directory WP-admin,WP-content and WP-includes in a standard WordPress Installation, which means that everyone knows that there is a WordPress directory and there is an WP-Content folder in it where all the themes and Plugin files are stored. These are the files which are targeted by Hackers however You can change the location of these files to another location by just adding a piece of code which will make it difficult for the hackers to find the location of files, although you shouldn’t be worried too much about this as it’s not easy for one to access these files.
However You should note that this doesn’t moves the Files and folders in your Directory, you have to do that Manually. This will only change the location and will instruct WordPress to find the folders at your specified location.
Note-Remember to change the site address or Directory address as per your need and Website in the below codes.
Changing the Whole WP-Content Folder to another Directory
1.Open the wp-config.php file and add the below code in it.
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/Foldername/wp-content' );
Now add one more code it in specifying the WP_CONTENT_URL
define( 'WP_CONTENT_URL', 'http://siteadress/folder/wp-content' );
Save it and You have Done.
If you wish to Change the directory of WordPress Plugins and Upload you can also do that however this will no work for themes folder.
Changing Plugin Folder
1.Open wp-config.php file and add the below code in it without any trail slash.
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/Directory/wp-content/plugins' );
And now add the below Code in it.
define( 'WP_PLUGIN_URL', 'http://siteaddress/dir/wp-content/plugins' );
Remember there can be some compatibility issue with some Plugins as the developer may have opted for other variables in their plugin in that case you will have to add the below code also.
define( 'PLUGINDIR', dirname(__FILE__) . '/dir/wp-content/plugins' );
Changing Upload Folder
1.Open wp-config.php file and add the below code in it.
define( 'UPLOADS', '/directory/wp-content/uploads' );
Save it and you have done.