I've opted to use the Understrap theme as a base theme for development.

How do I safely change the theme slug throughout the theme files, i.e. everywhere understrap appears?

Is it simply a case of performing a search and replace?


For a theme name Hello World a search and replace should be done in phases.

  1. Make sure you do a case sensitive search and replace.
  2. Replace Hello World with Example Name
  3. Replace hello-world with example-name
  4. Replace hello_world with example_name
  5. Modify theme folder name
  6. Look for any other namespaces that the theme uses and replace accordingly.

These steps will ensure that there is no unintended replacement which may break the theme.

  • FTR, the main areas the slug needed to be changed were <?php /** * @package understrap, <?php _e('message', 'understrap') ?>, & get_theme_mod( 'understrap_container_type' ); – Steve Apr 15 '17 at 12:35

Yes, a search and replace could work. Make a backup, do it and see what happens.

Depending on the theme and your adaptations, there may be some snags, however. For instance, the theme may sometimes derive the slug from the Name in style.css. If you change it in one place, but in another it uses the Name and there is a difference, things may not work. There may be a relation with the text domain or with actual file names which do not change with a search and replace.

So, once again, yes, search and replace could work. But there are all kinds of exceptions thinkable, which would lead to errors.

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.