Peter Knight Posted April 21, 2021 Share Posted April 21, 2021 Hi I have a list of pages all based on the same template but I want to exclude 2 by page ID $expertises = $pages->find("template=case-type, sort=sort"); foreach ($expertises as $expertise); I know I could change their template or add an exclude checkbox to the template etc Wondering if there is a page=not(4989,9877) type of thing in the API to exclude pages by ID? I can't find anything in the API docs but think I may be searching for the wrong phrase. Thanks Link to comment Share on other sites More sharing options...
horst Posted April 21, 2021 Share Posted April 21, 2021 https://processwire.com/docs/selectors/operators/ https://processwire.com/docs/selectors/ https://cheatsheet.processwire.com/selectors/ id!=1234, id!=2345 4 Link to comment Share on other sites More sharing options...
Peter Knight Posted April 21, 2021 Author Share Posted April 21, 2021 Thank you Horst. I was heading down the wrong track and looking at https://processwire.com/api/ref/wire-array/remove/ Link to comment Share on other sites More sharing options...
dotnetic Posted August 8, 2023 Share Posted August 8, 2023 To extend on Horst's answer: you could use a NOT selector with multiple ids separated by a pipe, to exclude them from the result like $expertises = $pages->find("template=case-type, sort=sort, ,id!=123|443|3035"); 1 Link to comment Share on other sites More sharing options...
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