steirico / kirby-plugin-custom-add-fields

Custom fields for Kirby's add dialog.
MIT License
36 stars 4 forks source link

Redirect does not work when I base page slug on title #57

Closed trych closed 2 years ago

trych commented 2 years ago

Hi there,

thanks for the useful plugin!

I am trying to redirect the user to the created page, however, I am also having a hook in place, that changes the newly created page's slug to the title:

site/config/config.php:

  'hooks' => [
    'page.create:after' => function (Kirby\Cms\Page $page) {
      $page->changeSlug(Str::slug($page->title()->value()));
    }
  ]

The redirect still sends me to the default timestamp url of the page though. Is there any easy way to fix this? Thanks!

steirico commented 2 years ago

As mentioned in the readme there is a related kirby issue which is not solvable.

The only option is to not enable redirection and landing on the parent page.