If I wanted to empty a specific field whenever a page is saved, how would I go about that? Is there some kind of ‘save’ hook that I could use?
You can use the panel.page.update
hook: https://getkirby.com/docs/developer-guide/advanced/hooks
1 Like
Thanks – for anyone looking, this is the code I ended up using:
kirby()->hook('panel.page.update', function($page) {
// Only update for specific page template:
if ($page->intendedTemplate() === 'templatename') {
$page->update(array(
'fieldname' => ''
));
}
});
1 Like