Metabox Date/Time Field Not Saving
- This topic has 7 replies, 2 voices, and was last updated 4 months, 3 weeks ago by
John Chvatal.
-
AuthorPosts
-
December 10, 2024 at 2:46 AM #47142
John Chvatal
ParticipantA client reached out on Sunday stating they could not save the date/time field. At first I thought it was because of the updates Flywheel was making (updating from MySQL 5.7 to 8.0). After contacting support, they stated this particular dev site was never using 5.7. I also made sure all plugins / themes were updated.
Today I started by disabling all non-essential plugins and switching to a default WordPress theme to rule out plugin conflicts. Saving the date/time field problem persisted. This was true for both the back-end post editor and the front-end update form.
In the process of checking into this, I noticed the front end update form I had on each post was not auto-loading the content already saved to the post. When checking the back-end the content was still there. The form is created by a shortcode.
The site is utilizing the Bricks theme. Not sure what else to try... Any guidance on what I can do is appreciated.
An example post: https://fixed-theatre.mysites.io/accident/cozy-mk-iv-n51810/
December 10, 2024 at 7:59 PM #47157Peter
ModeratorHello John,
Thank you for your feedback. I've tried to reproduce the issue but didn't see that. I can normally save the date-time field value on the local site. Can you please export the field group to a JSON file and share it here? I will import the field group to my site and check the issue.
Following the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--importDecember 11, 2024 at 7:04 AM #47162John Chvatal
ParticipantHello Peter, here is the JSON that I shared via a pastebin link: https://pastebin.com/H98vzPP5
December 11, 2024 at 9:07 PM #47167Peter
ModeratorHello,
After importing the field group to the demo site, I can add the value for the datetime field and save it as well, screenshot https://imgur.com/ecnXCkA
Please let me know if this happens:
1. with other fields.
2. without Bricks builder.
then you can try to increase the PHP settingmax_input_vars
and see if it helps. Read more about the PHP setting in the documentation https://metabox.io/wordpress-custom-fields-not-saving-increase-max-input-vars/December 12, 2024 at 4:39 AM #47170John Chvatal
ParticipantHello Peter,
Since my last post, I made a copy of the site and installed it on Local. The same issue occurred again. I just boosted input vars to 40000. I tried this on a site with a default WordPress theme and only Metabox plugins active. Other fields I tried worked normally.It is as if the date/time field saves to something random (not what I input). One thing I noticed is the minutes seem to save to the current time. For example: it is currently 3:35pm here. It saved as 21:35. If I waited a few minutes, it'd save as 21:37.
I went ahead and created another field group with date/time field and attached it to the Post post type. I found the field saved correctly both on the initial save and subsequent updates. I am thoroughly confused to what is going on here.
December 12, 2024 at 7:14 AM #47172John Chvatal
ParticipantHello Peter,
I think I found the root(s) of the problem.#1. The save format on the Date/Time field was Y-M-D. Once I removed this, the saving posts returned to normal.
#2. During the troubleshooting I updated Metabox to the latest version. It appears this update broke the front-end update form I added to the single post template via the shortcode. All field data that was previously added were set back to the default/blank fields. When viewing on the back-end, the data was still in those fields.
I double-checked this by restoring the site to a date prior to Sunday. Removed the save format. Verified that the date/time field was saving correctly. Then proceeded to update the Metabox plugins. It was at this point that the front-end forms broke.
So I suspect there were two concurrent problems that made things hard to diagnose... My input of the save format which at the time seemed to function normally but now it didn't. Then possibly a bug in the Metabox plugin.
December 16, 2024 at 2:12 PM #47185Peter
ModeratorHello John,
Regarding the saved time of the
datetime
field, if you add your custom save field format (Y-m-d) for the date, you also need to add the custom format for the time. For exampleY-m-d h:i:s
Refer to the PHP documentation https://www.php.net/manual/en/function.date.phpIf it still doesn't work on your site, please share your site admin account by submitting this contact form https://metabox.io/contact/
I will take a look.December 16, 2024 at 2:21 PM #47187John Chvatal
ParticipantPeter, I got the date time field to save. However, the front-end form remains broken when I update to the latest Meta Box version.
Currently running Meta Box 5.10.3 & Metabox AIO 1.30.2. Broke after updating to Metabox 5.10.3 & Meta Box AIO 1.31.0.
-
AuthorPosts
- You must be logged in to reply to this topic.