How to rename your wp-content Directory

Posted on June 25, 2013 @ 11:37 pm

Tags: ,

No Comments

Last updated on December 26th, 2015 at 10:25 pm

Secure your WordPress site by renaming wp-content

Some bloggers running WP want to add one more security layer and hide their wp-content from script kiddies by renaming to wp-content2 or to whatever they wish to.

If you want to join them follow my short guide below:

Access your wp-config.php located in the root of your WP site and edit it by adding the following lines:

define ('WP_CONTENT_DIR','/full/path/to/your/content/dir');
 define ('WP_CONTENT_URL','http://example.com/full/path/to/your/content/dirs/url');

Then Save and Refresh.

If you just installed WP then this is the only thing you have to do, on the other hand if your site was already alive and kickin then you should go and update all of your posts that host media uploaded via the WP Media Manager.

This extra step is necessary because when a media file(for ex. an image) is attached to any of your posts then its stored by default to the wp-content directory so if you rename that directory then all of your posts should be updated with the new path that hosts the attached media.

Read more constants about WordPress Configuration

CAUTION: Changing your wp-content directory name will break your plugins too so you may need to re-install them, moreover you may as well experience issues when installing new plugins.

Makis Mourelatos

WordPress Security Engineer at FixMyWP
WC Athens 2016 co-organizer, WP Support and Security Aficionado, Wannabe Kitesurfer.

Leave a Reply

Your email address will not be published. Required fields are marked *