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?
- Sorting list of sites from multisite network using wp_get_sites
- How to store the_title() into a variable to reutrn the value, not just echo it
- How can update custom meta for all posts
- Looping through WP_Post Object
- Using a javascript file to access a get posts array
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- How do I dynamically generate args for wp_query?
- Batch update a post meta field value of each post in Post Type
- Working with query_posts ( arrays and query strings)
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Remove duplicates – array_unique()
- The text box have space character
- Recent posts with featured image or fallback image with permalink
- WP Query with custom Shortcode
- Storing Array from returned database query and using the array in a new query
- Sort custom meta column by other meta value
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Need help with Google drive API [closed]
- Exclude posts based on meta value
- Custom query, checking values of multiple meta keys
- Alter required message using comment form api
- Advanced Custom Fields – display label and value only if value entered
- 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 can I access string value in an array?
- How to array only one key from another array
- Filtering a function’ output for a new continued function
- 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?
- How to say if meta_value is greater than 0 in an array?
- If Array Values Match Another Array’s Values, Then
- How to hide posts of a specific custom category in WordPress?
- I’m unable to call img path using single quotes in an array?
- WordPress meta_query >= &
- Comapare get_user_meta value
- How can get all users by current user meta?
- Get the id of all images in a post
- Output category list inside array
- Separate array output into a
- Update post meta – Custom field does not match meta-key
- Define category ID using get_post_meta
- Hide a div when a custom field is empty
- Front end file upload returning wrong attachment url
- Post meta select input, if statement
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- Add custom fields from different posts
- MySQL Query Returns Array () In Shortcode
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Order category posts by last word of custom field
- Is it possible to order posts using multiple meta queries, i.e. show posts from first meta query, then the second?
- Sending simple variable on single page to WP JSON
- in_array not working on dev server but works on localhost
- meta_query search names when they have middle initials
- How to update custom fields when post is published?
- How to display MySQL table data which is stored as an array?
- Fix common misspellings/errors based on array of replacements
- Show the subcategory name based on current product
- How to filter specific element of an array in wordpress/php?
- Unable to update the meta boxes with multiple fields
- Notice : Array to string conversion on array_intersect user meta
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- PHP array to jQuery array ” Uncaught SyntaxError: Unexpected token < "
- Adding user meta to post meta wp_insert_post() not working
- Display posts using post ID’s in an array
- Display a single row from nested array of custom field data
- Post from front end form to post_meta
- Reformat data within a nested array
- How to find the function which is outputting Array
- Create Customization Controls from Array
- Order by in foreach
- Postmeta not saving
- If custom field doesn’t exist, or exists and it’s true show title?
- !in_array doesnt recognize category
- get_post_meta no longer working
- Showing all post from all post type in admin backstage
- How to set if meta_value is lower < than other meta_value in a get_posts array?
- Populate checkboxes from array
- Metadata on the WP_Post object
- PHP Use Declared array Variable inside already Declared Array
- Why is my array_diff usage breaking things?
- How to group by column a and sum column b and c in a php array
- Adding date and time to the same request