I managed to get most of the database queries rewritten but, after several hours with hundreds of queries across dozens of pages, I was going a bit code blind and woke up to various errors having been logged. Hopefully they're now fixed. Some were stupid mistakes while a couple of others were scenarios I hadn't expected or catered for ... It would appear there are still some gremlins in the works. 😊
I just have the blog page itself to go but that has 43 prepared statements on its own so will take a while.
It's been good to work this out and make the code a bit more refined and reusable.