Skip to main content
added 1 character in body
Source Link
Nicolai Grossherr
  • 18.9k
  • 8
  • 64
  • 109

Use update_post_meta(), because if the meta key already exists add_post_meta() will do nothing if $unique is true and otherwise won't update eitherneither, while update_post_meta(), well, it will update the value of a existing field or create it, if it doesn't exist yet.

Use update_post_meta(), because if the meta key already exists add_post_meta() will do nothing if $unique is true and otherwise won't update either, while update_post_meta(), well, it will update the value of a existing field or create it, if it doesn't exist yet.

Use update_post_meta(), because if the meta key already exists add_post_meta() will do nothing if $unique is true and otherwise won't update neither, while update_post_meta(), well, it will update the value of a existing field or create it, if it doesn't exist yet.

Source Link
Nicolai Grossherr
  • 18.9k
  • 8
  • 64
  • 109

Use update_post_meta(), because if the meta key already exists add_post_meta() will do nothing if $unique is true and otherwise won't update either, while update_post_meta(), well, it will update the value of a existing field or create it, if it doesn't exist yet.