# Migration of Private Pages

**URL:** <https://discuss.liferay.com/t/migration-of-private-pages/1058>\
**Category:** General\
**Created:** [October 12, 2026, 1:49pm UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058 "2026-10-12T13:49:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisHof](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/chrishof/32/226_2.png) [@ChrisHof](https://discuss.liferay.com/u/ChrisHof)\
**Post date:** [October 12, 2026, 1:49pm UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058/1 "2026-10-12T13:49:58Z")

</div>

So Private Pages have been deprecated for a while. There was talk about a migration tool in one of [Dave’s blog posts](https://liferay.dev/b/breaking-up-with-private-pages-its-not-us-its-them#lwor_message_126881239) over a year ago, but after posting a comment a few days ago asking about an update, I haven’t heard anything (and haven’t found anything while searching before that).

Any news on this or a guide on how to migrate Private Pages to “Regular Pages” so the Deprecated Release Feature Flag can then be turned off?

---

<div class="post-metadata">

**Author:** ![ChrisHof](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/chrishof/32/226_2.png) [@ChrisHof](https://discuss.liferay.com/u/ChrisHof)\
**Post date:** [October 21, 2026, 7:02am UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058/3 "2026-10-21T07:02:01Z")

</div>

Sorry, didn’t check this for a few days…  
What worked for me (at least everything looks good so far in my local environment) is the following Groovy Script. I added some comments:

```auto
import com.liferay.portal.kernel.service.LayoutFriendlyURLLocalServiceUtil
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil
import com.liferay.portal.kernel.service.LayoutSetLocalServiceUtil
// Set groupId
groupId = 12345
// Save layoutPlids of updated child Layouts, otherwise concurrency error is thrown because DB entry is handled twice (once when looping over all Layouts and when setting the child parentLayoutId)
layoutPlids = new ArrayList<Long>()
// Loop over private Layouts of Group
for (layout in LayoutLocalServiceUtil.getLayouts(groupId, true)) {
    // If plid already updated, skip
    if (layoutPlids.contains(layout.getPlid()))
        continue
    // Save Layout children before updating layoutId, afterwards there won't be any children anymore
    layoutChildren = layout.children
    // Get next layoutID for public Layouts - otherwise an error might be thrown if privateLayout is set to false, since there is a DB Index on these fields and a Public Page might already have this layoutId
    nextLayoutId = LayoutLocalServiceUtil.getNextLayoutId(groupId, false)
    updateLayout(layout, nextLayoutId)
    // Loop over children and set the new layoutId as the parentLayoutId, then save plid in list. Only handles first level of children
    for (layoutChild in layoutChildren) {
        layoutChild.setParentLayoutId(nextLayoutId)
        updateLayout(layoutChild, LayoutLocalServiceUtil.getNextLayoutId(groupId, false))
        layoutPlids.add(layoutChild.getPlid())
        // Also update hidden System Layout with the new parentLayoutId
        layoutChildSystem = LayoutLocalServiceUtil.getLayout(layoutChild.getPlid() + 1)
        layoutChildSystem.setParentLayoutId(nextLayoutId)
        updateLayout(layoutChildSystem, LayoutLocalServiceUtil.getNextLayoutId(groupId, false))
    }
}
// Function to update the Layout, LayoutFriendlyURL and LayoutSet
def updateLayout(layout, nextLayoutId) {
    // Set new layoutId, set privateLayout to false and updage typeSettings
    layout.setLayoutId(nextLayoutId)
    layout.setPrivateLayout(false)
    layout.setTypeSettings(layout.getTypeSettings().replace("privateLayout=true", "privateLayout=false"))
    LayoutLocalServiceUtil.updateLayout(layout)
    // Update LayoutFriendlyURL - Only handles the default Locale 
    layoutFriendlyURL = LayoutFriendlyURLLocalServiceUtil.fetchLayoutFriendlyURL(layout.getPlid(), layout.getDefaultLanguageId())
    layoutFriendlyURL.setPrivateLayout(false)
    LayoutFriendlyURLLocalServiceUtil.updateLayoutFriendlyURL(layoutFriendlyURL)
    // Update LayoutSet
    layoutSet = layout.getLayoutSet()
    layoutSet.setPrivateLayout(false)
    LayoutSetLocalServiceUtil.updateLayoutSet(layoutSet)
}

```

I don’t think your `copyLayout()` way will work, since this will just copy the Layout and set its `privateLayout=true` again? The `copyLayoutContent()` method doesn’t work for me either, it doesn’t copy anything 🤷‍♂️ [Source here](https://github.com/liferay/liferay-portal/blob/7e4a3de53603f898bf333a7329928a9df5147437/portal-impl/src/com/liferay/portal/service/impl/LayoutLocalServiceImpl.java#L925)…

Either way, we also opened a support ticket for this last week. The first reply was “That’s just the way it is, you’ll have to manually create all the pages as Public Pages again and copy all of their contents.” We replied that is not an acceptable solution (and were surprised Liferay would even use this as an official answer from support for a feature that has been around for years and which they will remove in the future). Now Liferay will discuss it internally with the Product Team.

We want an official migration tool or path from Liferay. While my Script above looks ok locally, we don’t want to find issues when we use it in client environments. @dnebing wrote in [this blog entry](https://liferay.dev/b/breaking-up-with-private-pages-its-not-us-its-them) from January 2025 that a migration is in the works 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![ChrisHof](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/chrishof/32/226_2.png) [@ChrisHof](https://discuss.liferay.com/u/ChrisHof)\
**Post date:** [October 14, 2026, 7:40pm UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058/2 "2026-10-14T19:40:26Z")

</div>

@dnebing Any news on this?

I wrote a Groovy Script and have it working locally, but an official migration tool or guide would be nicer 😉

---

<div class="post-metadata">

**Author:** ![matthias.blaesing](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/matthias.blaesing/32/608_2.png) [@matthias.blaesing](https://discuss.liferay.com/u/matthias.blaesing)\
**Post date:** [October 31, 2026, 4:27pm UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058/4 "2026-10-31T16:27:33Z")

</div>

@ChrisHof Thanks for sharing! The approach looks like the idea I had in mind. I realised the friendly URLs would be a problem, but I overlooked, that the private/public split is also mirrored into the type settings. I’ll see if I can add a layout action that our authors can use to move pages.

The approach using `copyLayout` (with `private` set to false) seemed to work:

```auto
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil;
import com.liferay.portal.kernel.model.Layout;
import com.liferay.portal.kernel.service.ServiceContextThreadLocal;
import java.util.Map;
import java.util.HashMap;

long sourcePlid = 9578782L;
Layout sourceLayout = LayoutLocalServiceUtil.getLayout(sourcePlid);

Map<Locale, String> newNames = new HashMap<>(sourceLayout.getNameMap());
newNames.replaceAll({key, value -> return "Copy of " + value});

Layout resultLayout = LayoutLocalServiceUtil.copyLayout(
    sourceLayout.getUserId(),
    sourceLayout.getGroupId(),
    false, // private
    newNames,
    false, // hidden
    false, // system
    true, // copyPermissions
    sourcePlid,
    ServiceContextThreadLocal.getServiceContext()
);

// WebContent is copied incomplete, manual testing showed that running
// copyContent gives a sane result

LayoutLocalServiceUtil.copyLayoutContent(
    LayoutLocalServiceUtil.getLayout(sourceLayout.getPlid()),
    LayoutLocalServiceUtil.getLayout(resultLayout.getPlid())
);

resultLayout = LayoutLocalServiceUtil.getLayout(resultLayout.getPlid());
resultLayout.setParentPlid(734719L);
resultLayout.setParentLayoutId(370L);
LayoutLocalServiceUtil.updateLayout(resultLayout);

out.write(resultLayout.getPlid() + " - " + resultLayout.getFriendlyURL());

```

though retesting right now shows, that the friendly URL also needs to be updated explicitly.

We have a setup were the public tree is partly a mirror of the private tree. For these cases deleting of the private page is the most appropriate approach, but the other pages still need to be integrated and for these a finer grained approach seems sensible. I doubt that we’ll get a satisfatory approach from liferay, so I’ll continue the evaluation of the copy/relocation options.

---

<div class="post-metadata">

**Author:** ![ChrisHof](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/chrishof/32/226_2.png) [@ChrisHof](https://discuss.liferay.com/u/ChrisHof)\
**Post date:** [November 4, 2026, 11:24am UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058/5 "2026-11-04T11:24:29Z")

</div>

What version are you on? `LayoutLocalServiceUtil.copyLayoutContent()` doesn’t do anything on my end 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![matthias.blaesing](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/matthias.blaesing/32/608_2.png) [@matthias.blaesing](https://discuss.liferay.com/u/matthias.blaesing)\
**Post date:** [November 5, 2026, 6:25pm UTC](https://discuss.liferay.com/t/migration-of-private-pages/1058/6 "2026-11-05T18:25:26Z")

</div>

For the `copyLayoutContent`: I’m testing with 7.4.3.132 (we are preparing a DXP update, but the Jakarta migration triggered secondary updates that take longer than we wished). I have observed, that for our `portlet` pages I saw “broken containers” on the page at the location of the portlets and the call to `copyLayoutContent` fixed that.

For your code: Be careful with this “Also update hidden System Layout with the new parentLayoutId”. This was helpful for content pages indeed both layouts are required, but if you have other layout types (i.e. portlet) adjacent layouts are not related. Looking at the data I see that the classNameId and classPK columns of the system entries point back to the content page. Maybe that is a viable approach.

Be careful here. I experimentally deleted the “system” row of a content-layout pair and the page was then broken.
