This topic contains 2 reply and 1 voices, and was last updated by DeanT765 6 years, 4 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
July 15, 2013 at 11:01 pm 5984
DeanT765 Any time I go to make an edit on a post from a form with a repeat field, the data is out of order upon editing. Some of my repeat fields are alphabetized on display anyway but some of them need to displayed as ordered, and any edits ruin the order. Any tips on this?
July 22, 2013 at 8:53 pm 6200
DeanT765 DeanT765

Actually it appears to just reverse with each edit of a form…they’re stored from the the top down and populate the edit fields from the bottom up? And then stored that way, then reversed on editing.

I think I can track this one down on my own actually I’ll update if I do.

July 22, 2013 at 11:10 pm 6202
DeanT765 DeanT765

Found a quick fix…in frontend_form_post.php in the function update_post_meta I just copied and pasted this code again

foreach ($multi_repeated as $repeat_key => $repeat_value) {
            // first, delete any previous repeatable fields
            delete_post_meta( $post_id, $repeat_key );

            // now add them
            foreach ($repeat_value as $repeat_field) {
                add_post_meta( $post_id, $repeat_key, $repeat_field );
            }

And that solved the problem…if only by way of reversing twice for each time the post is saved so it’s always in the right order. I didn’t want to deal with reordering keys or anything so that is fine with me.

Viewing 2 Posts - 1 through 2 (of 2 total)