How to Exclude a Page from Yoast SEO XML Sitemap
On a WordPress site, Yoast SEO creates an XML sitemap, a file that lists URLs so search engines can find content. To…
If you have changed a WordPress theme’s files, settings, or CSS (the rules that control a page’s appearance), an update can overwrite some of your changes. A child theme gives you a separate place for code changes while the parent theme continues to receive updates. The parent theme is the original theme; the child theme extends it.
Creating the child theme does not automatically move every existing customization. You need to identify where each change lives, move file-based changes into the child theme, and handle database-stored settings separately. The steps below show you how to move those changes and check your child theme before you rely on it.
Start by separating changes made in theme files from changes saved in WordPress. The WordPress Theme Handbook explains how a child theme lets you change a theme without editing the parent theme’s files. That separation matters because WordPress replaces the parent theme’s folder when it updates the theme.
If you edited the parent theme’s style.css, template files, or functions.php, save those edits before updating the parent. Move each change into the corresponding file in the child theme, or recreate it there. A child theme does not copy modified parent files automatically.
Settings you change in WordPress’s Customizer, its theme-customization tool, are different: WordPress stores many of them in the database. A setting attached to the parent theme may not appear when you activate the child theme, because WordPress can keep theme settings separately for each theme. Custom CSS and theme-specific settings may also be stored differently. Record the settings you need and check how the parent theme handles them before switching.
If you use a block theme, which lets you edit a site with blocks, changes you make in WordPress’s Site Editor are stored in the database. You do not need a child theme just to protect those changes from theme-file updates. For a small CSS adjustment, use the Customizer’s Additional CSS feature when your theme provides it. The WordPress discussion of block-theme child themes covers cases where a child theme may not be needed.
Back up your site’s files and database before changing themes. Then create a folder for the child theme inside wp-content/themes. Name the folder something distinct, such as my-theme-child.
Create style.css in that folder. Its Template value must exactly match the parent theme’s folder name inside wp-content/themes, including capitalization:
/*
Theme Name: My Theme Child
Template: parent-theme-folder
*/
Replace parent-theme-folder with the actual parent folder name. The theme’s display name in the WordPress dashboard is not enough; a misspelled or incorrect folder name prevents WordPress from associating the child with its parent.
The child theme can also contain a functions.php file for code that adds features or loads styles. WordPress loads the child theme’s functions alongside the parent theme’s functions, so do not copy the parent’s entire functions.php into the child. Add only the code you need.
A parent theme may already load its CSS and the child theme’s CSS, or it may require you to enqueue styles in functions.php. “Enqueue” means asking WordPress to load a stylesheet in the correct order. Check the parent theme’s documentation or code before adding another stylesheet load, so you do not load the parent CSS twice. The Theme Handbook’s child-theme instructions explain the stylesheet relationship and loading options.
Before activating the child theme, decide how to handle the settings WordPress saved for the parent. WordPress stores many Customizer settings in a database entry called an option. The option name includes the theme’s name, as in theme_mods_parent-folder. The child theme uses its own theme settings, so copying the parent’s settings may be necessary for those values to appear.
You can examine and transfer settings with tools such as WP-CLI, phpMyAdmin, or a settings-copy plugin. Back up the database first, and avoid replacing the child theme’s settings with a copied database record unless you know what the record contains. Theme settings can include references to other saved data. For example, custom_css_post_id identifies saved custom CSS. Copying the settings alone may leave that reference pointing to the wrong content. WordPress users have documented these complications in discussions about preserving theme settings and moving parent-theme changes.
Some themes also store options outside the standard theme settings. Check the theme’s documentation or ask its developer which options to move. If you cannot identify the data safely, keep the parent active while you get help rather than copying database values blindly.
In the WordPress dashboard, open Appearance → Themes and activate the child theme. Check the pages and features that use your customizations. Confirm that the site still loads its styles, that the moved code works, and that the Customizer or Site Editor settings you recorded appear as expected.
Keep the parent theme installed and unchanged. After an update to the parent, test the child theme again. If the update changes a template or other file that your child theme overrides, you may need to adjust that child file to match the parent’s new structure. If you make extensive changes, you may need to keep maintaining the child theme; the WordPress Theme Handbook discusses when a separate theme may be a better fit.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com