Multidimensional array problem with update_post_meta [duplicate]
This question already has an answer here:
Problem storing arrays with update_user_meta 5 answers
I have an issue saving a multi-dimensional array using update_post_meta.
Here's my code ($meta_key and $userID are set up above):
$read_notices = get_user_meta($userID, $meta_key);
if (null === $read_notices) {
$read_notices = array();
}
$read_notices[] = $postID;
update_user_meta($userID, $meta_key, $read_notices);
My problem is that the data is nesting every time so I end up with... Any
ideas?
Array
(
[0] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 1823
)
[1] => 1762
)
[1] => 1762
)
)
No comments:
Post a Comment