admin管理员组文章数量:1318140
Looking for some Wordpress specific PHP help. I'm making a time sheet with employees listed and in/out for everyday of the week. I am pulling an ACF repeater row of employees from another page that the employees originally get added, easy enough. This page changes daily and my code should be able to accommodate new entries. When the page loads, it grabs the old array from post_meta. If the names pulled from the repeater already exists, skip and add new names. On the first load, all get added.
Then we're adding the names into an array ($settings_names) with extra fields i.e. Monday In, Monday out etc.
Then for each of the users in the array, I'm printing the Agent name (borrowed from the other ACF page) as well as Input fields representing the beforehand mention extra data fields. So far so good, this displays great.
Now I need to be able to enter times in those "extra" input fields and have them all save back to that array. Next time user comes back and loads the page, he should be able to se the previously inputed times, enter more time data and save again into the array.
So far the page pulls the repeater data as it should, displays as it should and I can enter times in the fields.
For testing, I can even add an "update_post_meta($post_ID, 'settings_name',$settings_names);" at the end of the page load and the array will fill one post_meta field with the entire array. No times added yet.
The fields are within Form tags and I have a submit button, but not sure how to do the update_post_meta so that the time inputs are saved.
So my trouble is, how do I get these individual rows of time data to save back into the array where they need to be, with each user?
I have found the 4th option for update post meta - $prev_value - Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries.
But I don't know if this works with the array.
Thanks for the help.
本文标签: phpSaving an array of dynamic repeater data as postmeta
版权声明:本文标题:php - Saving an array of dynamic repeater data as post_meta 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742046242a2417801.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论