Jump to content

Pagefield edit via api


joer80
 Share

Recommended Posts

I have a template that has a page field that holds several pages, and I have it working that I can add pages to its page field via api, but how do I remove a page without deleting the page it is linking to?  Just unlink it?

This is how I am adding it:

$pagetoadd = $page->id;

//Add page to a page field on 123
$p = wire("pages")->get("id=123");
$p->setOutputFormatting(false);
$p->pageFieldExample = $pagetoadd;
$p->save();

How would I remove one?  Or even remove all and add back what needs to stay?

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