I want to rename the theme's root folder for security purpose.

I put these in wp-config.php file:

But I want to rename the theme's root directory also:

 define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/assets' );
 define( 'WP_CONTENT_URL', 'http://www.domain.in/assets');

 define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/extension' );
 define( 'WP_PLUGIN_URL', 'http://www.domain.in/assets/extension');

So, how to rename the theme's root folder like this way?

  • 3
    Unfortunately you can't, themes is hardcoded throughout WordPress. May I ask how you think this will improve security? – TheDeadMedic Jun 24 '13 at 10:07

Although @TheDeadMedic is technically correct and you can't rename the themes folder. You CAN change some of the public facing urls.

For example, you can make a new folder assets/new-themes and add your CSS, and images there. Then make a theme include your styles.css (which can be just the header info) and anytime in your theme you want to refer to any image, css, or JS (public urls) set that to your new theme folder (or CDN if your fancy)

I'm not sure how changing the name of the directory would improve security as there are so many ways to find out if someone is using WP but that's just one way to apply a similar effect.

UPDATE: Looks like you can use the hook register_theme_directory() to add an additional theme dir. (see link to duplicate question above)

Not the answer you're looking for? Browse other questions tagged or ask your own question.