Jump to content

Exclude a page ID from selector

Peter Knight

Recommended Posts

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.


Link to comment
Share on other sites

  • 2 years later...

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");


  • Like 1
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

  • Create New...