Title: save() function doesn&#039;t save field with updated value
Last modified: August 22, 2016

---

# save() function doesn't save field with updated value

 *  Resolved [lim2me](https://wordpress.org/support/users/lim2me/)
 * (@lim2me)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/save-function-doesnt-save-field-with-updated-value/)
 * Pods version 2.5.1.1
 * Following the instructions on the [pods documentation](http://pods.io/docs/code/pods/save/),
   this is my code:
 *     ```
       $invoice = pods( 'invoice', $post_id );
       $invoice->save( 'invoice_sent_date', '2015-11-05' );
       ```
   
 * The problem is that the updated value isn’t saved.
 * For context, here is what I’m doing: I created a Custom Post Type called Invoice
   using the Pods admin interface. When I Publish a new Invoice, I’m using WordPress’s
   action hooks to call a custom function which contains the above code. The function
   will send an email then automatically update the field named _invoice\_sent\_date_
   with the current date (I’m using a value of 2015-11-05 for testing purposes)
 * As mentioned, the save() function doesn’t seem to be working. Really stumped 
   on this one.
 * [https://wordpress.org/plugins/pods/](https://wordpress.org/plugins/pods/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Nikhil Vimal](https://wordpress.org/support/users/nikv/)
 * (@nikv)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/save-function-doesnt-save-field-with-updated-value/#post-5763580)
 * Howdy,
 * This forum post may be similar to your problem, check out the code provided and
   see if that may help. [http://pods.io/forums/topic/saving-data-in-to-pod-fields-programatically/](http://pods.io/forums/topic/saving-data-in-to-pod-fields-programatically/)
 * Thanks!
 *  Thread Starter [lim2me](https://wordpress.org/support/users/lim2me/)
 * (@lim2me)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/save-function-doesnt-save-field-with-updated-value/#post-5763608)
 * [@nikv](https://wordpress.org/support/users/nikv/) Thanks for the link but it’s
   not quite what I need. The problem is the _pods\_api\_pre\_save\_pod\_item\_{
   podname}_ filter is called when the custom post type is either Published or Saved
   as Draft.
 * There is a way to differentiate Publishing from Saving as a Draft by checking
   agains the $_POST data but I’m wondering if this is really the best solution.
   I may have to re-think how I’m going about this.
 * My custom function must (1) Email the invoice, and (2) Update invoice_sent_date.
   I initially tied the function to the Publish button but didn’t think about Editing
   or Saving as Draft. At this point it may be better to have another button to 
   explicitly send the invoice.
 * I’m marking this thread as resolved for now. I need to re-think this. Thanks 
   again for responding.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘save() function doesn't save field with updated value’ is closed to new
replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

## Tags

 * [field](https://wordpress.org/support/topic-tag/field/)
 * [save](https://wordpress.org/support/topic-tag/save/)

 * 2 replies
 * 2 participants
 * Last reply from: [lim2me](https://wordpress.org/support/users/lim2me/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/save-function-doesnt-save-field-with-updated-value/#post-5763608)
 * Status: resolved