Jump to content

Unpublished pages incorrectly included in array


alexcapes
 Share

Recommended Posts

<?$work_pages = new PageArray();?>

<?$project_1 = $pages->get("parent=/work/projects, limit=1, sort=sort");
$work_pages->add($project_1);
// Code for Project 1 goes here

$project_2 = $pages->get("parent=/work/projects, id!=$work_pages, limit=1, sort=sort");
$work_pages->add($project_2);
// Code for Project 2 goes here

$project_3 = $pages->get("parent=/work/projects, id!=$work_pages, limit=1, sort=sort");
$work_pages->add($project_3);
// Code for Project 3 goes here
// etc

I have the above code which gets project pages then adds the project to an array to exclude from the next selector.

I'm sure this was working fine but seems to have started including unpublished pages - if I unpublish or hide pages they still show up. I've done some troubleshooting and have excluded any caching issues - the code is definitely pulling in unpublished pages.

Working on Processwire 2.8.35

 

Link to comment
Share on other sites

45 minutes ago, adrian said:

I should probably have known this (learn something new on PW everyday...)

Thanks Adrian - all working correctly now.

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

×
×
  • Create New...