Overriding/replacing hidden field value
-
Hi
I have a custom CMB2-based options page to run an “alert” popup with a checkbox and a WYSIWYG field to enable/disable the alert and store the HTML content. I now want to add a hidden field to save a timestamp to log when the text was altered.
I am populating the field with the “default_cb” parameter which worked perfectly on the first run but of course only fires when there is no value set. As I have saved the options once, the value is pulled from the database and the timestamp will never be updated.
I have a couple of ideas on how I can work around this by storing the timestamp elsewhere upon options being saved, but I was hoping there was just a way to do this in CMB2 itself as it would be a lot cleaner. Can I override the value of the hidden field specifically somehow?
Code I am using is below in case it matters:
array( 'name' => __('Updated Time', 'theme_textdomain'), 'id' => $prefix.'timestamp', 'type' => 'hidden', 'default_cb' => 'time', ),
Thanks in advance for any suggestions
- The topic ‘Overriding/replacing hidden field value’ is closed to new replies.