Assign/update the custom field value for all posts
I have over 1000 posts. Each post has a custom field XYZ. I’m looking for a function that I can run once that will assign a value of 1 to each of the posts’ custom field XYZ. I’ve had a look at this but i’m not getting how to put it into a one-time-run function?