Exercise 2: Why a Direct Theme Edit Disappeared After an Update — Possible Solution ==================================================================== WHAT ACTUALLY HAPPENED ------------------------------ Per this chapter's own finding-box, "directly editing a theme's own files is a genuine, common WordPress mistake: the next time that theme receives an official update, every one of those direct edits gets silently overwritten and lost." When the theme author released their update, the update process replaced the theme's files with the new official versions - including the exact files the developer had directly modified - erasing the custom feature along with it, with no warning that this would happen. WHY THE UPDATE PROCESS WORKS THIS WAY ------------------------------ A theme update is designed to replace the theme's own files wholesale with the newer, official versions - it has no way of distinguishing "official theme code" from "code someone else added directly into the same files," so it simply overwrites everything in the theme's folder with the new release. The developer's custom feature, having been added directly into the theme's own files rather than kept separately, had no protection from this wholesale replacement. WHAT SHOULD HAVE BEEN DONE INSTEAD ------------------------------ Per this chapter, "a child theme keeps customizations in a completely separate set of files that an update to the parent theme never touches." The developer should have built a child theme and added the custom feature there instead of editing the parent theme's own files directly. Because a child theme's files are physically separate from the parent theme's own files, a parent-theme update would replace only the parent's files while leaving the child theme's own custom code - and the feature it added - completely untouched. WHY THIS IS THE "SAFE" APPROACH, PER THIS CHAPTER ------------------------------ This chapter explicitly frames child themes as "the safe way to customize anything beyond what the Customizer or Site Editor already exposes" - precisely because it separates official, update-managed code from custom, developer-added code, so the two can never collide the way they did in this exact scenario. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains precisely what the update process does and why it destroyed the direct edit, and names the specific alternative (a child theme) this chapter identifies as the correct approach, explaining exactly why that alternative would have prevented the described outcome.