Reference newly duplicated page

I have a hook that duplicates a page:


How can I access the new page, to change its status, move it etc… ?

You need to store the return value in a variable:

$duplicate = $newPage->duplicate('-inv'); 
// then work with $duplicate


This works great:

       $duplicate =  $newPage->duplicate('-inv');

I thought I could do this to then go to the new page:

      $uri = $duplicate->uri();

Is there another method?

Currently, there is no way to redirect from a hook to a different location.

ah, ok - I have opened a feature request:

1 Like