Repeatable fields get messed up each time a post is updated
Author | Posts |
---|---|
August 28, 2013 at 10:03 pm 7586 | |
cob-web | Hi Tareq, I set up a repeatable field called 'credits'. When inserting credits, the actual order is very important (e.g director, camera, music etc). Each time I save a post, the order gets messed up. Also in the frontend the credits show in rather random order. The edit in this post doesn't make a difference to me: http://wedevs.com/support/topic/repeat-field-out-of-order/ I made some digging and found this http://wordpress.org/ideas/topic/add-order-by-meta_id-to-update_meta_cache but not sure if it has something to do with it. Do you have a hint? Thanks! |
August 28, 2013 at 10:57 pm 7592 | |
cob-web | I think I’ve found a solution for the frontend:
But I still worry about the backend, as my client doesn’t like the idea of “random changing” 😉 |
August 29, 2013 at 2:09 am 7601 | |
cob-web | I just found out, that each time a post is updated the repeatable fields get saved for new! It means each time the meta_id of it increases! Is this normal? Is it the way it works? It’s at 17632 now and growing…. This actually kind of explains the problem with the reordering: when I create a group of ordered fields, each time I update the post, they get reordered and saved for new. |
August 29, 2013 at 9:18 pm 7630 | |
Tareq Hasan | Yeah, that was normal behavior. Because as you’ve said, get meta functions doesn’t provide you the meta ID’s. So when you are going to update those, there is no way to know if you are updating the same items or you are adding a new item. So the little trick was to delete all existing and adding the items again. |
August 29, 2013 at 9:52 pm 7637 | |
cob-web | Thanks Tareq! |
August 29, 2013 at 11:58 pm 7641 | |
Tareq Hasan | No, I haven’t faced that issue. May be I need to recheck. |
August 30, 2013 at 12:04 am 7642 | |
cob-web | All right then. I’m also using WPML, which doesn’t seem to be 100% compatible with your plug-in. I’ll keep an eye on that. |