-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why are post metas are stored as an array instead of sperarate keys #13
Comments
Hmm, I need to look at this more closely, I am seeing this as well. |
Hey @adamsilverstein, I'm not sure #27 is the solution as meta data can be stored in any of the following ways:
Using I think at some point some assumptions would have to be made about the data if it's an array so if the response from
It should be enough to change it in the following way: $meta_values = get_post_meta( $post_id, $meta_key );
/*
* Use the underlying add_metadata() function vs add_post_meta()
* to ensure metadata is added to the revision post and not its parent.
*/
foreach ( $meta_values as $meta_value ) {
add_metadata( 'post', $revision_id, $meta_key, $meta_value );
} There are then going to need to be updates to the way revision is restored and also compared I think. |
Hi @joehoyle |
Note: Planning to implement #56 as soon as we can get to expanding tests for it. |
I noticed for some reason, all meta for a single key is stored as a single meta key (serialized array) in the revision meta, this makes calling
get_post_meta
on a revision return an array-encapsulated data rather than the data you would get from callingget_post_meta
on the parent post. I just wondered why that was?The text was updated successfully, but these errors were encountered: