When running this code in preview it works fine, but in the live site nothing happens. I’ve checked collections are synced & everything is saved before publish - can’t see why it wouldn’t work in the live site?
All the collection permissions are set to Admin only (as it’s a dashboard page). There is only one item in the collection, and it has been synced to live. Unless there’s something else I’ve missed, in live nothing happens at all.