# Deleting a page with subpages that have 'delete:false'

**URL:** <https://forum.getkirby.com/t/deleting-a-page-with-subpages-that-have-delete-false/16416>\
**Category:** Questions\
**Tags:** v3\
**Created:** [November 22, 2019, 2:24pm UTC](https://forum.getkirby.com/t/deleting-a-page-with-subpages-that-have-delete-false/16416 "2019-11-22T14:24:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [November 22, 2019, 2:24pm UTC](https://forum.getkirby.com/t/deleting-a-page-with-subpages-that-have-delete-false/16416/1 "2019-11-22T14:24:03Z")

</div>

This seems like a no-no from the start, but ¿Can I prevent a subpage to be individually deleted, while allowing it to be deleted along its parent?

Consider a page structure such as:

```
editions (delete: false)
    edition (delete: true)
        exhibitions (delete: false)
            exhibition A (delete: true)
            exhibition B (delete: true)
            ...
        performances (delete: false)
            performance A (delete: true)
            ...

```

I’d want to avoid users deleting categories such as ‘editions’ ‘exhibitions’ or ‘performances’ while I’d still want them to be able to delete items such as ‘edition’,‘exhibition’ or ‘performance’.

The problem is that the item ‘edition’ cannot be deleted because it contains the categories ‘exhibitions’ and ‘performances’ which cannot be deleted.

In this particular case permissions are not a solution because both the ability to delete itesm and the prohibition to delete categories affect the same type of user.

Thank you

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 22, 2019, 3:03pm UTC](https://forum.getkirby.com/t/deleting-a-page-with-subpages-that-have-delete-false/16416/2 "2019-11-22T15:03:41Z")

</div>

The only thing I can think of it to set `delete` to true for all pages, but then use a hook to throw an error if a user tries to delete an item they are not allowed to delete. Downside of this approach is that the option is still available in the menu and the no-no only comes when the user tries to execute the option.

---

<div class="post-metadata">

**Author:** ![adamkiss](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adamkiss/32/6058_2.png) [@adamkiss](https://forum.getkirby.com/u/adamkiss)\
**Post date:** [November 22, 2019, 3:08pm UTC](https://forum.getkirby.com/t/deleting-a-page-with-subpages-that-have-delete-false/16416/3 "2019-11-22T15:08:35Z")

</div>

Or you could do `delete: false` on the edition as well, but add a “Cancel the edition” or whatever button to the edition blueprint which forces the deletion of the edition

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [November 22, 2019, 5:11pm UTC](https://forum.getkirby.com/t/deleting-a-page-with-subpages-that-have-delete-false/16416/4 "2019-11-22T17:11:10Z")

</div>

Thank you both @texnixe and @adamkiss .

Would a ‘page.delete:before’ hook allow me to capture the ‘edition’ page delete attempt before it triggers an error on the subpages ?

If the answer is ‘yes’, would there be any way to cancel such attempt and trigger another one which would impersonate the kirby user.

If even possible, too much of a hack 😕 ?
