Wp-content folder contains WordPress themes and plugins, or we just call them extensions, which makes your WordPress different from others. You can rename wp-content directory with your desired name like “public_files” or “assets“. Renaming of wp-content directory helps to hide your wordpress information from the hacker.
Must Note Before changing It
There are several plugins and themes that do not follow best practices. They use “wp-content” as the path and URL in their code, instead of defining them dynamically. In such cases, the plugins and themes may not function properly. Furthermore, this will also break links to images that already attached in your posts and that are stored in wp-content.
So, this modification should be taken with caution and, it is better done when you just starting your website. Otherwise, it could ruin your website entirely, and there will be tons of things you have to fix.
Do not install any unknown extension unless you know exactly what it’s doing.Although WP extensions are open source, people might not take the time to read the code line by line. On the other hand, writing secure code is a skill not every developer learns that well, so it’s possible that a useful plugin becomes a backdoor for hackers. So, be careful when you install something new.
Renaming wp-content folder
Open the wp-config.php file in the root folder, and add these lines before last line containing:
require_once ABSPATH . ‘wp-settings.php’
You need to add these lines:
define ('WP_CONTENT_FOLDERNAME', 'your-content');
define ('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME) ;
define ('WP_CONTENT_URL', 'http://your-domain/'.WP_CONTENT_FOLDERNAME);
define ('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
define ('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');
Replace “your-content” with a new name you like, and replace “your-domain” with your site domain, then, you can rename “wp-content” folder to the new name.
In your code use content_url() function instead WP_CONTENT_URL, otherwise sooner or later you or some of your clients will run into problems with SSL certificate.