admin管理员组

文章数量:1122846

I have a custom post type - headstones, that contains pricing information in custom fields:

  • Cost of Stone
  • Cost of Carving
  • Cost Total
  • Retail Price of Stone
  • Retail Price of Carving
  • Retail Total

Of the above, the only two I should manually input or update are the Cost of Stone and the Cost of Carving fields. The remaining fields should be calculated based on some custom number fields in an options page.

Currently, I have this working when updating a single headstone, or adding a new one, the calculations are made and the retail prices added.

I can't quite figure out how to update all the headstones if I were to edit a field on the options page. For example, the options page holds the % margin to be added to each headstone cost. If I updated the margin on the options page, I would need to open every headstone and click update for the changes to take effect.

If possible, when the options page fields are saved, I need each headstone to be updated to.

I am also open to another method of doing this, it felt right at the time to store this info in an options page but if the update process can be made easier by storing the info elsewhere then I am happy to do so.

本文标签: ACFUpdating all posts of CPT when a custom field from options page is updated