$wire->addHookBefore('ProcessPageAdd::execute', function(HookEvent $event) {
	// Get the id of the parent page the new page is being added under
	$parent_id = $event->input->get->int('parent_id');
	// Return early if not the id of the parent page you want to target
	if($parent_id !== 1234) return;
	// The following line probably not strictly necessary because we will redirect in a moment anyway
	$event->replace = true;
	// Create the page
	$p = $event->pages->add('your-template-name', $parent_id, 'your-page-name');
	// Make the page unpublished to begin with
	// Save the unpublished status
	// Redirect to edit the page just created

Post Comment