This is an extra special RETURN OF THE JEDI themed episode of the v10 redesign series!
We left the last screencast utterly defeated. We were trying to use wp_list_pages() to output some navigation for the homepage of our Almanac section. One of our calls to it worked, the other didn’t. We tried all kinds of stuff to get it to work, everything failing. The Empire was knocking at our door.
In this screencast, we’ve taken a bit of a break, cleared out heads, and approached the problem fresh.
The error we ultimately discovered was that the program was running out of memory. We we either need to have it use less memory (probably too hard, we aren’t WordPress core devs here) or give it more memory. We opt for the latter.
WordPress by default uses 32MB of memory. In our wp-config.php file, we double that by adding:
I confirmed this with a WordPress core dev – this isn’t a bad thing to do at all. They said in fact it’s about time for them to up the default memory usage anyway. My server has many GB of memory, so this should not be a problem.
As soon as that is in place, the second
wp_list_pages() immediately starts working.
We should throw up a little bit of a yellow flag here and just note that if we have memory problems on the server, we should watch this page. I’m extra not worried though, because 99+% of the time this page will load, it won’t actually be running these functions and hitting the database and all that, it will be a static copy being served up by our caching setup.
Yay we did it!