WordPress Snippets at WPcustoms

Move and rename wp-content folder

These definitions rename and move your wp-content folder. Make sure you created the folder before uploading your modified wp-config.php file. Renaming the wp-content folder increases your website security but keep in mind that many plugin developer hardcode ‘wp-content’ directory into their plugins. These plugins may break and won’t work without a manual adjustment.


/**
 * Snippet Name: Move and rename wp-content folder
 * Snippet URL: https://wpcustoms.net/snippets/move-rename-wp-content-folder/
 */
  // usage: add this to your wp-config.php file
define ('WP_CONTENT_FOLDERNAME', 'newfoldername');
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/newlocation/newfoldername' );
define( 'WP_CONTENT_URL', 'http://www.yoursite.com/newlocation/newfoldername' );