Create a WordPress Child Theme to Safely Customize Your Site
Step‑by‑step guide to create a WordPress child theme that lets you customize safely while preserving parent theme updates.
20 Jan 2026, 23:12 UTC

Desired Outcome
You will have a functional child theme that inherits all styles and templates from a parent theme, letting you add custom CSS, PHP overrides, or template files without losing the ability to update the parent theme.
Prerequisites
- WordPress installed (any recent version).
- File system access to
wp-content/themesvia FTP/SFTP, file manager, or SSH. - A parent theme you want to customize (e.g.,
twentytwentyfour). - Write permissions for the
wp-content/themesdirectory.
Procedure
- Create the child theme folder
Navigate to the themes directory and make a new folder. Use a clear, lowercase name, e.g.,
twentytwentyfour-child.# Run this on the server via SSH (replace placeholders as needed) cd /path/to/wordpress/wp-content/themes mkdir twentytwentyfour-childIf you use FTP/SFTP, create the folder manually in the same location.
- Add
style.csswith the required headerInside the new folder, create a file named
style.css. Paste the following header, adjusting the values for your parent theme./* Theme Name: Twenty Twenty‑Four Child Template: twentytwentyfour Version: 1.0.0 Text Domain: twentytwentyfour-child */The
Template:line must exactly match the parent theme’s directory name (case‑sensitive on some servers). - Enqueue parent and child stylesheets
Create a
functions.phpfile in the child theme folder. Use the recommended method to load the parent stylesheet first, then the child’s.<?php function my_child_theme_enqueue_styles() { $parent_style = 'parent-style'; /* matches the parent theme’s handle */ 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') ); } add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' ); ?>This keeps the parent’s CSS intact while allowing your child’s
style.cssto override it. - Activate the child theme
Log in to WordPress admin, go to Appearance → Themes, locate your new child theme, and click Activate.
Expected Checks
- Confirm the active theme shows your child theme’s name and screenshot under Appearance → Themes.
- View the page source of any front‑end page; the loaded stylesheet URL should point to
wp-content/themes/twentytwentyfour-child/style.css(the parent’s style is enqueued first). - Add a test line to
functions.php, for example:
error_log( 'Child theme loaded – ' . time() );
- Reload a page and check your server’s error log (or WordPress debug log) for the message; its presence confirms the file is being executed.
- If you copy a template file (e.g.,
header.php) into the child theme folder, verify that your changes appear on the site while the parent file remains unchanged.
Recovery Options (Rollback)
Creating a child theme only adds files; it does not modify the parent theme. If the child theme causes issues:
- Rename the child theme folder (e.g.,
twentytwentyfour-child_disabled) via FTP/SFTP or SSH; WordPress will automatically fall back to the parent theme. - Alternatively, delete the folder entirely.
- If you still have admin access, you can reactivate the parent theme directly from Appearance → Themes.
Limitations and Practical Verification
- Case sensitivity: On Linux servers,
Template:must match the exact case of the parent folder name. - Version‑dependent functions: If the parent theme removes or changes a function in an update, custom overrides in
functions.phpmay produce errors. Test on a staging site first. - Avoid copying large blocks of parent theme code into
functions.php; use hooks and filters to keep upgrades smooth.
To verify everything works after an update, repeat the checks in the Expected Checks section and ensure no new PHP errors appear in the logs.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.