wp-post-meta-revisions
wp-post-meta-revisions copied to clipboard
Non-unique meta-key are saved together in autosave
We are using CMB for the custom meta boxes. (I know it is deprecated but waiting for a whole site refresh to migrate away).
There is a non-unique meta key ph_tabs with an array as value. The data is saved as follows in the database

The metadata for the autosave is fetched from $_POST.
https://github.com/adamsilverstein/wp-post-meta-revisions/blob/ca459926808b025c256654962e577c91597dd0e0/wp-post-meta-revisions.php#L76
Plugins like CMB send the data in a array and this caused for the data to be saved as one big array instead of seperate rows for each array.
This is how the $_POST looks like:
Array (
[ph_tabs] => Array (
[cmb-group-0] => Array (
[ph_tab_title] => Array (
[cmb-field-0] => New tab
)
[ph_tab_content] => Array (
[cmb-field-0] => Content
)
)
[cmb-group-2] => Array (
[ph_tab_title] => Array (
[cmb-field-0] => Tab Title
)
[ph_tab_content] => Array (
[cmb-field-0] => Content second tab
)
)
)
)
I will create a PR with a fix.