📝 Fix a Multisite Network Where Updating the Main Site’s Theme Silently Breaks Child Sites Sharing the Same Theme Files
A WordPress multisite network keeps a single shared copy of each network-activated theme’s files, with every site on the network just pointing its own content and settings at those same templates – there’s no per-site duplicate to edit safely. Changing a template file to assume a custom field or menu location that only exists on the main site changes that assumption for every site sharing the theme at once, so a tested-and-working edit on the main site can produce a blank section or a visible error on a child site the moment that file is requested there instead.
🔎 The Problem
Main site's theme file functions.php edited to assume every site has a custom field named 'hero_subtitle' and a menu location called 'primary'. Network Admin > Sites > child site B, which has neither that field nor that menu configured: Front end of site B: PHP Notice - Trying to access array offset on value of type null in functions.php, hero section on the homepage renders completely empty. Site A, where the change was actually tested: works fine.
✅ Fix: Guard Shared Template Code Against Sites That Don’t Have the Same Setup
- Never hand-edit a network-shared theme’s files based only on what the main site has configured – test any change against a child site that deliberately lacks the main site’s extra fields and menus before rolling it out network-wide.
- Wrap any template code that reads a custom field or menu location in an explicit existence check rather than assuming it’s always present, so a site without that particular setup degrades gracefully instead of throwing a notice.
- For behavior that genuinely needs to differ per site, branch on the current site’s own identifier within the shared template rather than assuming every site on the network should behave like the main one.
🚨 Why This Is Dangerous
- Because the files are shared, rolling back a bad edit on the main site rolls it back for every child site simultaneously too – there’s no way to fix only the site where you noticed the problem without also touching every other site on the network.
On a multisite network, every theme file you edit is really editing every site at once – only the content on each site pretends otherwise.


