Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Can the wordpress theme folder be renamed any time freely and everything works fine after that ,

themes/oldthemename
themes/whatevernewname

or is it so that if you change the folder name that contains theme files - then the theme wont work any more because theme folder name is related to the theme files somehow ...

share|improve this question

5 Answers 5

This depends on how the theme was developed from the beginning. Theoretically, if everything was coded to standards you can rename the folder and nothing bad will happen.

When renaming the folder you are at risk of breaking code that asks specifically for files from the theme directory by name. WordPress offers a number of functions to help decouple the theme directory.

Using these function a theme can achieve loose coupling with what directory it resides in. Thus, if the theme that you want to rename the directory for has made good use of the above functions, then you should be fine.

Just in case, you can do a grep for the theme directory and see if it pops up in any javascript as a hardcoded path.

You will however have to reactivate it in your Appearance > Themes.

I just did this with twentyten and when you go to the admin you will see:

The active theme is broken. Reverting to the default theme.

Reactivate the theme and see if it works. twentyten does, twentyeleven does too.

The same goes for plugins, too.

wp_enqueue_style and wp_enqueue_script Codex pages state the following:

You should never hardcode URLs to local scripts, use Function Reference/plugins_url (for Plugins) and Function Reference/get_template_directory_uri (for Themes) to get a proper URL.

share|improve this answer

If your Theme uses the built-in core updater (i.e. if the Theme was installed from the official Theme repository), I believe that changing the name of the Theme's install directory will cause the updater not to recognize it, because the updater uses (among other things), the directory as part of its algorithm for determining a theme's uniqueness.

So, if that's the case, if you change the Theme's directory name, you may break automatic updates from the repository.

share|improve this answer
  1. 1.No it will give errors and wont work because wordpress stores theme name in database.
  2. If you are using absolute url of any images or links in your pages or posts it will give errors or break the links and image path.
  3. Suppose u changed the theme name 'X' to 'Y' on live site. You will see your site be messed up.

Before going to do such thing please read about theme development http://codex.wordpress.org/Theme_Development

share|improve this answer
    
2. Theme directories do not store uploaded images, links to posts are virtual queries, nothing to do with themes. –  soulseekah Oct 22 '11 at 12:00
    
My point was suppose you call an image which is stored in themes/sampletheme/images/example.jpg so if you changed the sampltheme to sampletheme123 then what will happen. It will not show up the images... –  w3uiguru Oct 22 '11 at 12:02
    
You have to call it like get_stylesheet_directory_uri().'/images/example.jpg', even when domain changes, or WordPress is moved to a subdirectory on the server - you'll still get to it no matter what. –  soulseekah Oct 22 '11 at 12:12
    
Your example is correct but we cant add template tags in editor. Can we? like <img src="get_stylesheet_directory_uri().'/images/example.jpg' /> –  w3uiguru Oct 22 '11 at 13:10
    
Why on earth would you want to insert images from your template directory into your post? All attachments reside in the uploads folder, template directories are off limits. –  soulseekah Oct 22 '11 at 13:13

A straight forward rename of the folder and theme name will fail, BUT, if you copy the folder and rename the copy, then go into themes options, activate the new renamed version, then delete the old version, it should work.

share|improve this answer

@Soulseekah is completley correct! if the theme was built correctly you wont have any problem changing the name (But then reactivate it)..

Why dont you just try? Max you can change it back.. it has (in 99% of cases) no affect over the database..

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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