Jump to content

Publish Pages via API


suntrop
 Share

Recommended Posts

Hi all

All I could find was the opposite of what I need, how to unpublish a page via API. But I need to publish 500 pages. Those pages are children of/inside a PageTable field … don't know if this matters.

Anyhow, I tried to loop through the child pages and publish them. But even one doesn't work … it just stays unpublished

// Pagae 2603 is my page with 500 unpublished children 
if ($page->id == 2603) {
	$fcp = $page->children('status=unpublished')->first();
	$fcp->removeStatus(Page::statusUnpublished);
	$fcp->save;
	// foreach ($page->children as $c) {
	// 	…
	// }
}

There is no such method like publishPage?

Link to comment
Share on other sites

You could also use Batch Child Editor's edit mode to change the status of all 500 children at once. Simply click the checkbox for the "Unpublished" label and that will uncheck it for all child pages.

597148baaa98b_ScreenShot2017-07-20at5_19_48PM.thumb.png.2e221e93423e72b5ec94f8aad8f48340.png

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...