I have a post type, products, and I’d like to add content to all the fields that i created. More specifically I’d like to run a function that says:
Set the “ship_date” field on all products that are in the “duck” category to “2/1/2021”
Is there a way to do this?
The easiest way to do something like this would be to add a custom field to your category and then use this value instead of the value associated with individual products.
The only way to set this value for all products would be to run a query to get all of the products in the category and update each product individually and you would need something to trigger this update. This could be done using my first suggestion, using and acf/save_post action that runs when the category is updated. However, this solution is not scalable and could time out if there is a large number of products that need to be updated.
I have 284 products and I’d like to add data to the repeater fields. anywhere from 5 to 12 repeater lines. Do are there any samples of something similar to get me started?
Thanks!
How Do I Create A URL For An Image?