I would like to change the child-theme name on my localhost (MAMP) set up for a project I'm working on. Obviously changing the folder name is easy enough, as is changing the child-theme's name in the comments at the top of the child-theme's style.css file.

How do I change the info in the database / phpMyAdmin though? Which I'm guessing I'll have to do because of how the child-theme links to the database?

Any help would be amazing.



Recommended Method

You don't have to change anything in the database. Follow these steps:

  1. Activate a default WordPress theme (e.g. twentyseventeen) - that is any theme other than the child theme you are going to rename.

  2. Rename your child Themes folder name and child theme's name in style.css file.

  3. Now activate the child theme.

That's all, WordPress will update related info. in the Database autometically.

Note: You've already figured out step-2 correctly. Just need to follow step-1 before step-2 and then step-3 afterwards. That's all.

Database Method:

It's also possible to change the theme name from the database after following step-2 above. Sometimes it's helpful in case you've already changed the theme name & now can't access the site because WordPress has a different theme name in the Database.

In this case, know that WordPress saves two values in the wp_options table. One is with the option_name = stylesheet and the other one is the option_name = template.

If it's not a child theme, then both the values are same. For a child theme however, option_name = stylesheet will have option_value = your-current-child-theme-name and option_name = template will have option_value = parent-theme-name.

So if you change these two values accordingly, it'll work as well. You can use PHPMyAdmin, or the following MySQL query:

update wp_options set option_value = 'new-child-theme-name' where option_name = 'stylesheet';

update wp_options set option_value = 'parent-theme-name' where option_name = 'template';

replace new-child-theme-name and parent-theme-name accordingly in the above query.

  • 1
    and if you're curious in learning more about how WP stores things "under the hood", the child theme name is stored as the value of the option_value column of the $wpdb->options row whose option_name == 'stylsheet' Feb 19 '17 at 23:08
  • Thanks for that Fayaz. I couldn't find the answer anywhere on the site.
    – The Chewy
    Feb 19 '17 at 23:23
  • @EmilyChewy that's OK, we all were there at some point.
    – Fayaz
    Feb 19 '17 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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