# No panel::go() in Page.update:after Hook?

**URL:** <https://forum.getkirby.com/t/no-panel-go-in-page-update-after-hook/27016>\
**Category:** Questions\
**Tags:** v3\
**Created:** [November 15, 2022, 11:07am UTC](https://forum.getkirby.com/t/no-panel-go-in-page-update-after-hook/27016 "2022-11-15T11:07:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![habundloot](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/habundloot/32/12508_2.png) [@habundloot](https://forum.getkirby.com/u/habundloot)\
**Post date:** [November 15, 2022, 11:07am UTC](https://forum.getkirby.com/t/no-panel-go-in-page-update-after-hook/27016/1 "2022-11-15T11:07:12Z")

</div>

Hello everybody,  
I am trying to redirect to a parent page called “blog” if the user changes the date year to another one as the date year before.

This is how my hook looks actually

```auto

use Kirby\Panel\Panel;
...
'options' => [
    'fieldName' => [
        'publishDateFieldName' => 'publish_date'
    ]
],
'hooks' => [
    'page.update:after' => function ($newPage, $oldPage) {

        if ($newPage->intendedTemplate() == 'blog-article') {
            $dateField = option('vendor.plugin.fieldName.publishDateFieldName');
            $oldPagePublishYear = $oldPage->$dateField()->toDate('Y');
            $newPagePublishYear = $newPage->$dateField()->toDate('Y');

            if ($oldPagePublishYear !== $newPagePublishYear) {
                Panel::go(Panel::url('pages/blog'))
            }
        }
    }
]

```

The date comparison works as expected, the renaming of the option field works as expected but when it comes to the Panel::go() method I get the error:

```auto
The form could not be saved
Exception: Kirby\Panel\Redirect
http://steilaufwaertss-macbook-pro.local:8888/kirby/ensun/panel/pages/blog

```

Is there a chance to get the redirect to work? Do I have to interact via JavaScript then? Or does anyone else have an idea? I tried an own Hook that gets triggered, when the page.update:after hook fires. But that didn’t do the trick. The error is still the same.

Maybe someone has a workaround or something?

Kindest regards  
Mo

---

<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 15, 2022, 11:14am UTC](https://forum.getkirby.com/t/no-panel-go-in-page-update-after-hook/27016/2 "2022-11-15T11:14:53Z")

</div>

> [@habundloot](#):
>
> Is there a chance to get the redirect to work?

No, you cannot redirect from the hook.
