joer80 Posted March 10, 2017 Posted March 10, 2017 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?
joer80 Posted March 10, 2017 Author Posted March 10, 2017 I found it! Posting for future people. http://cheatsheet.processwire.com/pagearray-wirearray/setting-and-modifying-items/a-removeall/ http://cheatsheet.processwire.com/pagearray-wirearray/setting-and-modifying-items/a-remove-key/ 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now