• Resolved webgardengeek

    (@webgardengeek)


    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.

Viewing 1 replies (of 1 total)
  • Hello @webgardengeek,

    Thank you for reaching out to us.

    That doesn’t work due to how WCK stores data. Basically, in the backend you manage a serialized array that after that same it then saves information in non-serialized post meta, with what you’re working with. So if you modify just the non-serialized post meta, WCK doesn’t take those changes into account. Basically it’s double saving the information. It’s bad from a programming p.o.v. but it’s due to the fact that adding support for non-serialized post meta was more important then this inconsistency.
    You can still make changes as long as you make them in both the serialized and non-serialized post meta.

    Kind regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Meta Fields’ is closed to new replies.