So the current project on which i am working, does not have workflow set and the client needs a barrier against accidental content publish. Now, if I mark "Never Publish" on the standard value of the templates, All the items will be deleted from the web database.

Is there a way to set all the items created henceforth to never publish ?

2 Answers 2


You can add custom hander to item:created event and set the value of Never Publish to true:

public void OnItemCreated(object sender, EventArgs args)
    var createdArgs = Event.ExtractParameter(args, 0) as ItemCreatedEventArgs;

    Assert.IsNotNull(createdArgs, "args");
    if (createdArgs != null)
        Assert.IsNotNull(createdArgs.Item, "item");
        if (createdArgs.Item != null)
            Item item = createdArgs.Item;
            item.Publishing.NeverPublish = true;

and register it via patch file:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <event name="item:created">
        <handler type="My.Assembly.Namespace.ClassName, My.Assembly" method="OnItemCreated" />
  • Thanks @Marek Musielak sometimes the solution is right in front of you but you are too consumed with a specific set of solutions May 20, 2019 at 6:31

If you want a code-less approach, just create a Branch Template based on your item template, and set the publishing restrictions on the default item of the branch.

enter image description here


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.