WordPress child theme, what it is, how to create one and how to update your theme without breaking the site

A WordPress child theme is a small theme that sits on top of your regular theme and holds all your own code changes, so the regular theme can be updated without losing anything. Without one, every update replaces the theme files with the files of the new version and wipes out whatever someone had changed inside them. The child theme is also the method recommended by the WordPress documentation itself.

Why are my changes lost after a WordPress theme update

WordPress does not merge files. On every WordPress theme update it deletes the theme folder and puts in the new one. The same happens with every plugin, so also with every Elementor update, for both Elementor and Elementor Pro.

Common reasons the site changes appearance after an update:

  • Changes were made to theme files, such as style.css, functions.php or templates, without a child theme.
  • Changes were made to the code of Elementor or another plugin. These are always lost on the next update, because plugins have nothing equivalent to a child theme.
  • Elementor and Elementor Pro were left on versions that don't match each other, because only one of them was updated.
  • Some plugin is running a beta version.

The problem is not related to the hosting. It would happen in exactly the same way with any provider. Also note that Konet may enable automatic updates for WordPress, themes and plugins for security reasons, as provided in the Terms of Service. Changes inside theme or plugin files are not safe in any case.

What is a child theme and how does it work

A WordPress child theme is a folder with a few files that declares which theme is its parent. WordPress loads whatever is in the child theme first and uses the parent for everything else.

  • The child theme's style.css is the only required file. In its header, the Template line declares the parent theme. Your own CSS goes below it.
  • The child theme's functions.php is optional. It loads together with the parent's, it does not replace it. Your own PHP code goes there.
  • A template with the same name in the child theme replaces the parent's corresponding template.

This way the parent theme stays untouched and receives updates normally. When a new version comes out, only the parent changes and your own changes stay in place.

Creating a child theme, which method to choose

Before any change, make sure there is a recent backup of the site. At Konet, JetBackup 5 keeps automatic backups, see the JetBackup 5 guide. Better still, test first on a staging copy, as described further down.

A ready-made child theme from the theme developer

Many developers provide a ready-made child theme along with the theme. For Hello Elementor there is the official Hello Elementor Child. Look first in the files you downloaded or on the developer's page.

  1. Open Appearance > Themes > Add New Theme > Upload Theme.
  2. Upload the child theme zip and click Install Now.
  3. Click Activate. The parent theme must remain installed.
  4. Check the site in a private browsing window.

Creating a child theme manually

If the developer does not provide a ready-made child theme, you can create one yourself with cPanel File Manager.

  1. Open cPanel > Files > File Manager and go to public_html/wp-content/themes. Note the exact folder name of the parent theme, for example mytheme.
  2. Click + Folder and create a new folder using lowercase letters and hyphens, for example mytheme-child.
  3. Inside the new folder click + File, create the file style.css and open it with Edit.
  4. Write the header at the top and click Save Changes:
/*
Theme Name: MyTheme Child
Template: mytheme
*/
  1. The Template line must be exactly the same as the parent theme's folder name, with the same upper and lower case. Otherwise WordPress does not recognize the child theme.
  2. Open Appearance > Themes in WordPress and click Activate on the new theme.
  3. Check the site in a private browsing window.

If after activation the site appears without its styling, the parent theme loads only the active theme's style.css. In that case create a functions.php file in the same folder with this content, as given in the WordPress documentation:

<?php
add_action( 'wp_enqueue_scripts', 'mytheme_child_enqueue_styles' );

function mytheme_child_enqueue_styles() {
	wp_enqueue_style( 'mytheme-parent-style', get_parent_theme_file_uri( 'style.css' ) );
}

Don't copy functions from the parent into the child theme's functions.php. Identical function names cause a critical error and the site stops loading.

A child theme for a block theme with Create Block Theme

Block themes, such as the default Twenty Twenty-Four and Twenty Twenty-Five, are edited from Appearance > Editor. Whatever you change there, colors, fonts, templates, header and footer, is stored in the database and not in the theme files. That is why these changes are not lost when the theme is updated.

You need a child theme for a block theme only if you want to change files, for example theme.json, a template as a file, or PHP code. The simplest way is the official Create Block Theme plugin from WordPress.org.

  1. Install and activate Create Block Theme from the WordPress Plugins menu.
  2. Open the Editor. The plugin's icon appears next to the save button.
  3. Click Create Theme and then Create Child Theme, give it a name and finish.

Settings to watch after activation

In classic themes, the settings from the Customizer, menu locations and widgets are stored separately for each theme. When you activate the child theme, you may need to set them again or transfer them with the settings export feature that many themes have. Pages you built with Elementor are not affected. For everyday changes to text and images, see editing content with Elementor and WPML.

If the changes have already been made inside the parent theme, they must first be moved to the child theme and only then can the update be done. This is a job for the site's developer, because it requires comparing the files with the original version of the theme.

Where small CSS changes go without a child theme

For a few lines of CSS you don't need a child theme. Use one of the fields that are stored in the database and are not affected by updates.

  • In classic themes, Appearance > Customize > Additional CSS.
  • In block themes, the additional CSS option in the Editor styles.
  • In Elementor Pro, the Custom CSS fields of pages, elements and site settings.

Don't use the Theme File Editor for changes to a parent theme. It edits the files directly and the next update replaces them.

How do I test the update on a copy of the site (staging)

The safest approach is to test updates first on a staging copy of the site, on a subdomain such as staging.example.gr. The copy counts toward your plan's disk space and databases, so delete it when you are done. You will find all the methods, including moving the copy to the main domain, in the guide to WordPress staging.

With Softaculous. If WordPress was installed with Softaculous, open cPanel > Software > Softaculous Apps Installer and go to the list of installations. On the site's row click Create Staging, choose the subdomain and finish. Run the updates on the copy and check it. If you want to move the changes to the live site, use Push to Live on the staging row. Otherwise, once you see everything works, run the same updates on the live site. For a simple copy with no link to the live site there is also Clone.

Manually. First create a subdomain in cPanel. Then the site's files and database are copied to a new database and the site's addresses are changed inside the copy. It is more complex and suits someone with experience, or your developer.

With WP Toolkit. Konet's cPanel also has WP Toolkit, where Clone on the site's card creates a copy on a subdomain and Copy Data moves the changes back to the live site.

How do I update without breaking the site

  1. Test the updates on the copy first, as in the previous section.
  2. Update Elementor and Elementor Pro together, so they stay on matching versions. The same applies to every plugin that has a separate Pro add-on.
  3. Don't enable beta versions on a live site. In Elementor > Tools > Version Control the Become a Beta Tester option must stay disabled. Elementor itself does not recommend beta versions on production sites.
  4. After updating Elementor click Clear Files & Data in Elementor > Tools > General, so the CSS files are regenerated.
  5. If you use LiteSpeed Cache, purge the whole cache.
  6. Check the site in a private browsing window (Incognito), so you don't see a cached version from your browser.

Frequently Asked Questions

I updated and the site broke, how do I roll it back now?
The quickest way is to restore files and database with JetBackup 5 to a date before the update. You will find detailed steps in the article WordPress broke after an update.

How do I do an Elementor rollback to the previous version?
From Elementor > Tools > Version Control > Rollback Version you choose an earlier version and install it. Keep a copy of the database first. If you also have Elementor Pro, roll it back to a matching version.

The appearance broke, but it looked right on staging, why?
You are usually still seeing cached CSS files. Click Clear Files & Data in Elementor, purge the LiteSpeed Cache and open the site in Incognito. If it continues, compare the plugin versions on the site with those on staging.

Can I create a child theme afterwards on a live site?
Yes. You activate the child theme and the site keeps using the same parent theme. Just watch the Customizer settings, menus and widgets in a classic theme, as explained above. Do it on staging first.

The developer changed code inside Elementor Pro, what do I do?
Those changes will be lost on the next update and not even a child theme can protect them. Ask for them to be moved to a child theme or to a small plugin of your own, using the hooks Elementor provides. Until then, don't update Elementor Pro without having a backup.

Should I stop updates so the site doesn't break?
No. Old versions often have known security holes and are among the most common reasons sites get compromised. The right solution is to keep your changes in a child theme or in CSS fields and to test updates on staging first.

Does Konet create the child theme or move my changes?
Hosting support does not include code changes to themes and plugins. See what hosting support covers. Such work is done only as an exception, after it has been agreed with you. To discuss it, open a ticket from the Client Area.

Was this article helpful?

Related service Konet Web Hosting cPanel, LiteSpeed and automatic backups: 24 every 2 hours for 48 hours, then 6 daily, 4 weekly and 3 monthly.