19 Years Later: The Undocumented Optimizely Category Inheritance That Caught Me Out
Posted: 20 Mar 2026
I recently ran into an issue on a site running Optimizely CMS 12 where categories assigned to a parent page were automatically being applied to newly created child pages.
After reviewing the ticket, I was able to reproduce the issue locally without much trouble.
This one genuinely confused me.
My immediate assumption was that the project must have had some custom initialization logic causing the behaviour. I went through each initialization module, adding breakpoints anywhere that looked even remotely suspicious - particularly anything that could be copying categories from the parent.
Nothing stood out. Still, I stepped through everything just to be sure.
No luck.
At that point, I started digging deeper. I spent hours going through Optimizely’s documentation, source code, forum posts, and blogs. The only thing I could find was a forum thread from 2009 discussing how to stop category inheritance:
Surely this couldn’t still be relevant in 2026 - 19 years later?!
Turns out, it was!
After a quick support ticket with Optimizely, an escalation to an SME, it was confirmed that it was an undocumented feature in the CMS! Thankfully, the SME provided me with some example code to work around this using...yep, you guessed it: an initialization module!
Code below:
using EPiServer;
using EPiServer.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using System.Linq;
namespace EpiserverFull.Business.Initialization
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class StopCategoryInheritInitialization : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
var events =
ServiceLocator.Current.GetInstance<IContentEvents>();
events.CreatingContent += CustomCreatingContent;
}
public void Uninitialize(InitializationEngine context)
{
}
public void Preload(string[] parameters)
{
}
private void CustomCreatingContent(object sender, ContentEventArgs
e)
{
//clear the category if the content is child page and inherits
the category from parent
var content = e.Content as PageData;
if (content != null)
{
if (content.Category.Any())
{
content.Category.Clear();
}
}
}
}
}Hopefully, that helps someone out who might be facing a similar issue! I have no doubt that I'll be revisiting this post again, at some point in the future!
