Can wordpress theme folder name be changed freely and nothing technically happens

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 …

Related posts

Leave a Reply

5 comments

  1. 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.

  2. 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.

  3. 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.

  4. @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..

    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