Jump to content

Keep a page created via the API unpublished?


evanmcd
 Share

Recommended Posts

Hi,

I'm creating a number of pages via the API, all of which will need to be kept unpublished until later review.  Is there a way to do this via the API?

I haven't seen a property of the Page class that looks like it would do the trick.

Thanks.

Link to comment
Share on other sites

Here's how to do it:

$page->addStatus(Page::statusUnpublished); 

Note that $page->status is a bitmask, so it can contain several different statuses at once (for instance, hidden and unpublished). It can be set directly. But because bitwise arithmetic isn't always fresh on my mind, I think it's safer and easier to use $page->addStatus() and $page->removeStatus() for dealing with it.

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...