Skip to content

$page->changeStatus()

Change the status of the current page to either draft, listed or unlisted.

$page->changeStatus(string $status, int $position = null): Kirby\Cms\Page

Parameters

Name Type Default Description
$status * string "draft", "listed" or "unlisted"
$position int null Optional sorting number

Return type

Kirby\Cms\Page

This method does not modify the existing $page object but returns a new object with the changes applied. Learn more →

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException If an invalid status is being passed

Parent class

Kirby\Cms\Page

Details

Note that you cannot change the status of a page using this method if you have set permissions that disallow changing the status, e.g. set status: false in your blueprint.

Kirby's objects are immutable. That means, when you modify an object like $page, $file etc. using a method like update(), changeTitle() and so on, a new object is returned. Therefore, you have to store the returned object in a new variable to be able to further work with it.