You may need to unserialize the data to get the array and loop through it thus:
$userid = 832; // or 1540
$votes = get_post_meta($postid,'voter');
$votes = maybe_unserialize($votes);
if (is_array($votes)) {
// votes is the array, key is numeric index, vote is subarray
foreach ($votes as $key => $vote) {
// subarray values are in another array with key 'voter'
if ($vote['voter']['voter_id'] == $userid) {
$votes[$key]['voter']['vote'] = $newvote;
$votes[$key]['voter']['voter_ip'] = $newvoterip;
}
}
update_post_meta($postid,'voter',$voter);
}
Related Posts:
- How can merge two arrays values in one array and save in database
- Compare two meta key values against each other inside the get_posts array?
- Can an array be used as a meta_query value?
- List of posts by day of the week
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Archive post by meta value + 24hours
- Is it possible to retrieve all posts with a certain value for metadata?
- Grouping posts by a custom meta value
- How to use two meta_compare in an array?
- Remove empty terms from array, sort alphabetically, update back to repeating field
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Order a WP_Query by meta value where the value is an array
- Update value of a associative array with update_post_meta
- WP post meta – for loop inside for loop
- Remove item from post_meta array via AJAX
- Efficient way of querying for a “fallback” post?
- WordPress update_post_meta updating with empty meta_value field [closed]
- Alter required message using comment form api
- Advanced Custom Fields – display label and value only if value entered
- get_users meta_query: REGEXP not working for matching new lines
- Get post id within comments loop
- meaning of (array)function()
- Non-Closing PHP Query in WordPress Loop
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- wp_force_remove_style’ not found
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How can I access string value in an array?
- How to use if statement in an array? [closed]
- How to array only one key from another array
- Filtering a function’ output for a new continued function
- Output meta into arrays
- Querying Database with wpdb
- Get html data with javascript to php array and store to wordpress database
- How do I create a numbered list with PHP? [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- update_post_meta only updating on last loop of foreach
- How to use array in function to get only value I want
- Error while setting role
- Get categories names as an array to use it in theme settings
- how to get serialized post meta
- How to get the last category name of a child category?
- How to say if meta_value is greater than 0 in an array?
- Warning: in_array() null given in PHP function
- WP_Query: getting posts where custom field exists
- Foreach loop inside an array_merge
- Loop over Array and get the distinct ids
- How to access or parse key/values that have “string”
- If Array Values Match Another Array’s Values, Then
- User Meta Value not echoing despite Var_Dump Showing correct string
- Only show first image in foreach loop
- Conditional multidimensional arrays and array_map
- WordPress yoast seo plugin – parse snippet var in meta description
- How can I get all values from my array in a loop in php? [closed]
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- How to store multiple custom meta box
- How to hide posts of a specific custom category in WordPress?
- Undefined offset: 0-wp-includes/meta.php:488 -Melding
- change order of images attached to post
- Passing an array into WP_Query as a variable
- I’m unable to call img path using single quotes in an array?
- Filter by field with array value in ACF on WP REST API
- WordPress meta_query >= &
- extract serialized array to use for wp-query
- How to add post meta in while loop?
- get users search not working with array
- Add category to post meta
- Comapare get_user_meta value
- How can get all users by current user meta?
- Using rules in Posts
- Get the id of all images in a post
- How do I remove duplicate users from two merged WP_User_Query objects?
- Output category list inside array
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- Multidimensional Array
- Separate array output into a
- array_rand not working correctly?
- Update post meta – Custom field does not match meta-key
- Get css class of menu item in custom menu structure
- Dynamically adding filters
- Save the value of a wp_dropdown_pages
- Add a custom class to the body tag using custom fields
- Define category ID using get_post_meta
- Only load certain artists on this page
- add the value of a variable returned in a while loop [closed]
- Unable to Call More than One Meta Box Output
- Hide a div when a custom field is empty
- Front end file upload returning wrong attachment url
- How to make sure relative URL works when site is not on root domain?
- Get URI from PodPress using PHP
- Post meta select input, if statement
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- using images in next/previous_post_link [closed]
- Finding and removing duplicates within WP Arrays
- Using multiple variables to assign categories to an array
- WordPress stripping out custom field tags
- Custom functions for string data calculations
- Add custom fields from different posts
- Repeat a function with 24hrs gap for n number of days