When a custom field (text type to keep it simple) with a default value is created for a post type, say page, any new Pages created from that point onward will have that post meta with the default value when the Page is published/updated.
But already existing Pages will not have the post meta unless we go in each and update them. This is fine for a few Pages but not ideal for larger sites.
What is the recommended method for programmatically updating the post meta for existing Pages with the default field value?
I tried writing the following in a function hooked to init that loops through Pages where the custom field in question does not exist