Skip to content
Products
AI Website Builder New VPS Hosting Cloud Servers Web Hosting Dedicated Servers Domains
Company
About Documentation Support Center Contact Get Started Call +91 75795 45488
Login
Hosting Panel — cPanel & Billing Console Panel — VPS Management
ALL SYSTEMS OPERATIONAL
WordPress

Theme Update Wiped Your Changes? Fix It With a Child Theme

Getwebup 7 min read

You tweaked the header spacing, added a custom function, changed a color in the parent theme's CSS file — and it worked, right up until the theme updated itself and every one of those changes vanished. This is one of the most avoidable support tickets we see, and it happens because WordPress themes are designed to be replaced wholesale on every update, not merged with your edits.

Symptom: your customizations disappear after an update

The pattern is always the same:

  • A theme update notification shows up in wp-admin, you click "Update," and the site looks fine at first glance.
  • Then you notice the custom CSS you added directly to style.css is gone.
  • Or a function you dropped into the theme's functions.php — a custom shortcode, a hook, a tweak to remove some default WordPress behavior — no longer runs.
  • Template overrides you edited by hand, like single.php or header.php, are back to the theme author's original version.

Nothing crashed. There's no error in the debug log. The site just quietly reverted to stock behavior, and now you're redoing work you already did once.

Cause: theme updates overwrite every file in the theme folder

When WordPress updates a theme, it doesn't try to figure out which lines you changed and preserve them. It deletes the old theme directory and replaces it with a fresh copy of the new version, full stop. Any file you edited inside /wp-content/themes/your-theme/ gets replaced along with everything else.

This is by design, not a bug. Theme authors can't merge arbitrary edits from thousands of sites into their update packages, so the update process treats the whole folder as disposable. The only files WordPress considers "yours" are ones living outside that folder — which is exactly what a child theme gives you.

We see this go wrong in a few common ways:

  • CSS added through Appearance → Customize → Additional CSS is actually safe — that's stored in the database, not the theme files. But direct edits to the theme's own style.css or a plugin-free custom stylesheet inside the theme folder are not.
  • A freelancer or previous developer edited functions.php directly instead of setting up a child theme, and nobody flagged it before the next update ran.
  • Auto-updates for themes got enabled (Plugins/Themes page, per-theme toggle) without anyone realizing direct edits existed underneath.

Quick check: were you editing the parent theme directly?

Look at your file structure over SSH or in cPanel File Manager, under public_html/wp-content/themes/. If you only see one folder for your active theme (say, astra or oceanwp) and no folder ending in -child, you've been editing the parent theme directly, and this will keep happening on every future update until you fix it.

Fix: set up a child theme and move your changes into it

A child theme is a small, separate theme that inherits everything from the parent but lives in its own folder, so theme updates never touch it. Here's how to set one up properly.

Step 1: create the child theme folder

Connect over SFTP or use cPanel's File Manager and create a new folder next to your parent theme:

public_html/wp-content/themes/yourtheme-child/

Inside it, create two files to start: style.css and functions.php.

Step 2: add the required style.css header

WordPress identifies a child theme from a comment block at the top of style.css — this is what makes the relationship official:

/*
 Theme Name: YourTheme Child
 Template: yourtheme
 Version: 1.0
*/

The Template line must exactly match the parent theme's folder name (case-sensitive), not its display name. If your parent theme lives in /wp-content/themes/astra/, the value is astra.

Step 3: load the parent theme's styles

Most themes today handle this automatically via wp_enqueue_scripts, but the safe, universal approach is to enqueue the parent stylesheet from your child theme's functions.php:

<?php
add_action( 'wp_enqueue_scripts', 'yourtheme_child_enqueue_styles' );
function yourtheme_child_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css',
        array( 'parent-style' ),
        wp_get_theme()->get('Version')
    );
}

Step 4: move your customizations over

Now bring your actual changes into the child theme instead of the parent:

  • CSS tweaks: add them below the header comment in the child theme's style.css. They'll load after the parent's CSS and simply override matching rules.
  • PHP functions: copy any custom functions from the parent's functions.php into the child's functions.php. Don't copy the entire file — just your additions. The child's functions.php loads alongside the parent's, not instead of it, so you only need what you added.
  • Template overrides: if you edited a file like single.php or page.php directly, copy that file into the child theme folder, preserving the same path (e.g. woocommerce/single-product.php if you customized a WooCommerce template). WordPress checks the child theme first for any template file and falls back to the parent automatically.

Step 5: activate the child theme

Go to Appearance → Themes in wp-admin, and you'll see the child theme listed (using a generic default screenshot, which is normal). Activate it. The site should look identical to before — if it doesn't, double-check the Template line in style.css and confirm the parent theme's folder name matches exactly.

Step 6: revert the parent theme to stock

This part matters and gets skipped often: undo your direct edits in the parent theme, or better, re-download a clean copy of the parent theme from the theme author and replace the folder entirely. If you leave your old edits sitting in the parent theme files, the next parent theme update will overwrite them anyway — which is fine now, since the child theme is where your real customizations live — but a hand-edited parent theme also means you can't easily tell, six months from now, which changes are "real" and which are theme-author defaults.

Doing this over WP-CLI

If you have SSH or cPanel Terminal access, WP-CLI can create the skeleton faster:

wp scaffold child-theme yourtheme-child --parent_theme=yourtheme --theme_name="YourTheme Child"

This generates a working style.css and functions.php with the enqueue code already wired up, so you only need to fill in your actual customizations.

Prevention: keep future changes out of harm's way

  • Never edit parent theme files again — everything new goes into the child theme's functions.php, its style.css, or an overridden template file inside it.
  • Use a code snippets plugin (like WPCode or Code Snippets) for small PHP tweaks if you'd rather not touch functions.php directly — snippets stored this way survive both theme and child-theme changes, since they live in the database.
  • Keep a backup of the child theme folder separately from your full-site backups — it's small, and if you ever need to rebuild a site fast, the child theme is the one folder that actually represents custom work, as opposed to files you can re-download from the theme author.
  • Check before enabling theme auto-updates. Once your customizations live in a proper child theme, enabling auto-updates for the parent theme is safe. Until then, leave it off.
  • Document non-obvious changes in a comment at the top of the child theme's functions.php — future you (or whoever inherits the site) will want to know why a particular hook exists.

What if the theme already has an official child theme?

Some commercial themes (Astra, GeneratePress, Divi in some setups) ship an official child theme you can download separately, already wired up correctly. Check the theme author's documentation before scaffolding your own — using their version means you inherit any theme-specific hooks or filters they've already accounted for, rather than reinventing it.

Frequently asked questions

Will switching to a child theme change how my site looks right now?

No, as long as the child theme correctly enqueues the parent's stylesheet and you haven't changed anything else yet. Activating it should be visually identical to the parent theme — you're just changing where future edits live.

Do I need a child theme if I only use Additional CSS in the Customizer?

No. CSS added through Appearance → Customize → Additional CSS is stored in the database, not in theme files, so it survives theme updates on its own. Child themes only matter if you're editing theme files directly — style.css, functions.php, or template files.

Can I create a child theme for a theme built with a page builder like Elementor or Divi?

Yes, but most of your actual design work in a page builder lives in the database (post content, builder settings), not in theme files, so it isn't affected by theme updates the same way. A child theme still matters if you've added custom CSS/PHP outside the builder itself.

What happens if I get the Template line wrong in style.css?

WordPress won't recognize the child theme as valid, or it'll show as broken/incompatible in Appearance → Themes. Double-check it matches the parent theme's actual folder name under wp-content/themes/, not the theme's display name — they're often different (e.g. folder 'generatepress' vs. display name 'GeneratePress').

Is it safe to delete the parent theme after activating the child theme?

No — never delete the parent theme. The child theme depends on it for every template file and function it doesn't explicitly override. Deleting the parent will break the site immediately.

#wordpress #child-theme #theme-update #functions-php #customization #wp-cli

Keep reading

Chat with Support