Virtual page - change slug in panel

I have a Kirby 3.10 website that uses virtual pages that are stored in a database.
When I try to update the slug of a page in the panel, this will be reflected in the database. but not back to Kirby. When it tries to redirect, it tries to redirect to the same page.

I tried using the following changeSlug functions, but they don’t update the slug.
How can I make this work?

pubic function changeSlug($slug, $languageCode) {
//Code to update slug in the database

//Update slug in current context
$this->setSlug($slug);
return $this;
}
pubic function changeSlug($slug, $languageCode) {
//Code to update slug in the database

//Create a new "Page" object with the updated slug
$pageData = [
//Page data
'slug' => $slug
];
return Page::factory($pageData);
}

I’ve followed this guide and that’s what I’m doing in the first function in my original topic. But it doesn’t work.

I need to test this, but won’t be able before tonight.

1 Like