• Hello!
    First of all, MF2 is very usefull plugin, thank you for your jub guys!
    So, the point of problem:
    While developing functionality for my project I had to hook the update_post_meta and add_post_meta to perform some actions… and I was very surprised to find that MF2-driven post meta never updated! They always removed/added when I save my post, and they always increment meta_id every time I updated the post.
    Furthermore, hooks are called twice every time I updated post.

    In other hand, when I use native WP meta fields – they called the update hook, where meta_id wasnt incremented, just valued updated.

    So the question: why do you devour meta_id? Why dont you use update_meta functionality?

    https://www.ads-software.com/plugins/magic-fields-2/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author hunk

    (@hunk)

    Hi, this is for duplicate fields/groups. when the post data is send i only have the current values, i don’t not if if user delete some field or group. for example.

    before de send data que user has 3 groups duplicates (a,b,c) , the user delete the “b” group, save, then MF only get the values of fields of “A” and “B”.

    for solve this point I thought I could get all fields/groups make a diff (current and fields of post data), update only the fields that still exists and delete the rest. but…

    In MF you can reorder groups. MF uses the follow format for the name in inputs: name_of_field[ group_index ][ field_index ] , when you add/delete/reorder the indexes of the group is reordered.

    so when a try the save the data i don’t know which is the old index of field/group, for solve this we need a function who save the previous positions, if user delete some group/field, if he added or reorder groups for N changes. send this information, analyse this information, define which groups/fields they existed and that index had.

    many troubles for only update values, at that moment I thought it was easier to delete all fields and recreate them.

    Thread Starter hav_ngs_ru

    (@hav_ngs_ru)

    well, that seems sanely.
    but in the abstract it still seems to me not good practice to increment id with every update. even unsigned bigint is not endless.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘MF2 devours meta_id counter… why not to update meta instead of delete/add it?’ is closed to new replies.