My Wordpress database somehow got messed up.
I am using ACF repeater fields and the repeater count shows zero even though I have as many as 12 repeating elements.
I am trying to update the repeater count so the field values will properly display in admin.
update wp.sd_postmeta set meta_key = ( SELECT count(*) as count FROM wp.sd_postmeta where meta_key like 'child_products_%_sku%' and post_id = pid) where meta_key like 'child_products' and post_id = pid
or
update wp.sd_postmeta set meta_key = ( SELECT count(*) as count FROM wp.sd_postmeta where meta_key like 'child_products_%_sku%' and post_id = pid) where meta_key like 'child_products' and post_id = pid
The question is, how do I generate a value for pid? I'd like to loop over all of the posts with a meta_key of child_products.