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 …
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.
get_stylesheet_directory_uri
get_template_directory_uri
get_theme_root_uri
get_bloginfo
)__FILE__
and__DIR__
, along withdirname()
, etc.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:Reactivate the theme and see if it works.
twentyten
does,twentyeleven
does too.The same goes for plugins, too.
wp_enqueue_style
andwp_enqueue_script
Codex pages state the following: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.
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.
@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..
Before going to do such thing please read about theme development http://codex.wordpress.org/Theme_Development