Hi! I’m trying to create some pages inside a loop. But when I try to create a page that is a child page of just created page it seems that is not possible and it creates the child page in the content root directory. Below is the code, there you can see that the signup page is child to account. There is any some kind of function that updates the site pages index? Or a better way to achieve this?
The problem here is that you try to create children of a just created page without fetching this page first, i.e. addressing it via the $newPage variable.
What is the purpose of your script? Does the set of pages to create contain pages on all sorts of levels? I think things would be easier if the children of a page like the account page were actually part of that array with a children key, then you could check for that key and use the newly created page to create the children, something like:
The purpose is to make a like a “quick install” . The solution you suggested worked perfectly for me. Once again, thank you for your help. You are amazing!