Custom Meta Fields
-
Ok…
I used WCK Pro to create a post type ‘distributors’. Then to create a custom metabox that’s a repeater with metadata id ‘orderdetails’. It has 3 fields and as many rows as you want.
If I enter data into the repeater via the edit post screen, it enters just fine and you can see the data in the template on the front end.
There is also a way for distributors (as a user type) can log in and from the front end submit an order using a custom form. That custom form, upon submit sends a couple of emails, builds the form fields into an array and then uses update_post_meta to upload that array to the meta box (e.g. update_post_meta(get_the_ID(),’orderdetails’,$orderArray); )
This works just fine as long as NO data was ever entered through the back end system (e.g. the WCK interface on the post edit screen). However, if data was ever entered via the WCK interface on the post edit screen, programmatic updates to post meta stop working — and delete_post_meta also does not work for some reason, so it’s not like I can simply delete whatever’s there and replace it with the array that’s built in the template once the form is submitted.
I get this is a nuanced issue, but hoping maybe someone else has run into this problem and found a solution.
- The topic ‘Custom Meta Fields’ is closed to new replies.