André Amorim

Crafting Web Experiences

Home » My Notes » Rename wp-content/ directory to something different

//

Rename wp-content/ directory to something different

You can relocate the wp-content folder by defining these constants in wp-config.php before the require_once line that loads wp-settings.php:

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/your-folder-name' );
define( 'WP_CONTENT_URL', 'https://yourdomain.com/your-folder-name' );

What each constant does:

  • WP_CONTENT_DIR – the absolute server path to the new folder (used for file system operations)
  • WP_CONTENT_URL – the absolute server path to the new folder (used for file system operations)

Checklist before switching:

  1. Physically move the wp-content folder to the new location on the server
  2. Add the constants to wp-config.php before wp-settings.php is loaded
  3. Update any hardcoded URLs in the database (use WP-CLI’s search-replace or a plugin like Better Search Replace)
  4. Check your .htaccess — rewrite rules referencing wp-content directly may need updating
  5. Test that themes, plugins, and media all load correctly

Published date:

Modified date: