Code snippet to hide the Categories tab in edit mode

Code by:

David Knipe


EPiServer UK
Esteemed Citizen

Former EPiServer Most Valued Professional (EMVP). Now working for EPiServer in London as Principal Solution Architect.

This snippet can be used to hide the categories tab in edit mode (if you installation does not use EPiServer categories). Tested on EPiServer CMS 6 R2 but should work on older versions. 

Used for Product: EPiServer CMS 6
Code sample:

[GuiPlugIn(Area = PlugInArea.EditPanel)]
public class RemoveCategory : ICustomPlugInLoader
{
    public PlugInDescriptor[] List()
    {
        EPiServer.UI.Edit.EditPanel.LoadedPage += new LoadedPageEventHandler(EditPanel_LoadedPage);

        //Never return a plugin - we don't want to add tabs.
        return new PlugInDescriptor[0] { };
    }

    void EditPanel_LoadedPage(EditPanel sender, LoadedPageEventArgs e)
    {
        if (e.Page.Property["PageCategory"] != null)
            e.Page.Property["PageCategory"].DisplayEditUI = false;
    }
}


All use of the code is on a “use at your own risk” basis. Episerver is under no circumstances responsible for any direct or indirect loss experienced by users or project owners, when downloading and using code presented within the section Code on Episerver World. Please note that this is example code and should not be used within production environment without testing. Episerver do not support the code examples posted within the section Code on Episerver World.