You can just assign a new value to the 1h_userbadge_comments25
key.
Like so…
<?php
$meta_value = get_user_meta($user_id, 'lh_userbadges', false);
// just assign this key a new value
$meta_value['lh_userbadge_comments25'] = 25;
Then just save it again.
<?php
update_user_meta( $user_id, 'lh_userbadges', $meta_value );
Whether or not storing all of those values as an array is the correct way to do this is really up to you. Do you need to do a lot of changing around like this? Do the all these values make sense together? Without knowing more about what you’re doing, that’s a hard question to answer.
Related Posts:
- How to save data of an input field to an array
- Updating wordpress user meta data array (unexpected multiple arrays)
- Get custom_user meta value and add entry
- Nice way to print_r arrays
- WordPress: How to use post_class() in an echo
- Building a scalable WordPress favouriting plugin – one serialised meta value array or many meta records
- How do I pass an array as an argument to a WP-CLI command?
- Comma seperated list of ID’s as an array?
- post__in works but also prints the word Array
- if is_singular array not working as expected
- Get posts id in array by meta value and key
- Sort a custom post type array numerically
- How to add day number and initial to my post graph?
- How to validate register settings array
- How to check an array of $curauth fields?
- Problem with wp_update_post
- Replace text inside a huge multidimensional array
- Multiple User-Meta Values in One User-Meta Key
- How to insert new element to existing array in usermeta?
- update_post_meta() with a modified array?
- How pass a 0 in $atts?
- get_*_meta doesn’t always return an array
- Retrieving multiple values to the Post Meta (using an array)
- Stuck with a Custom Field Check box Array
- Compare with WP Meta Query
- How to Translate a string of an array inside a class?
- Modify foreach loop for social sharing links?
- Combine get_page_by_title to exclude pages from wp_list_pages
- Plugin settings page checkbox not saving – one options array with sub array
- Selecting and outputting results from DB with an array
- Struggling with array and foreach loop
- Update post meta does not serialize array
- Customizer Settings in Arrays
- How to get all users by custom current user meta (array)?
- How to use json_decode a post_meta value? [duplicate]
- How to decipher the following array
- How to display line breaked meta values in table?
- Get user_meta values for a user for an array of meta_keys?
- Organizing and grouping an array by year
- array_filter warning – wp-includes/post.php line 3148
- Can’t access PHP array inside script localization from javascript
- Array in meta key?
- Obtaining values from objects
- How to get a page array and category array going at the same time?
- last_name + first_name orderby with meta_query [solved]
- How to order users by a date in the meta_value array
- If Array Values Match Another Array’s Values, Then
- How to get user ID’s from multiple usernames?
- Matching slug terms from one array to those in array of WP_Term objects to output term names
- Print specific values stored in a post meta array
- Comapare get_user_meta value
- How can get all users by current user meta?
- WP Page Options Array
- Array is not working in Filter?
- Exclude specific user_id from args in get_comments
- return paginate_comments_links() as array
- Inserting a random number into an array [closed]
- Array of user ids to list of user names
- Random element in get_post_meta array
- update_user_meta duplicates entry
- Add formatting to Array
- Why are array_slice() and array_chunk() not working?
- Retrieve array items without page ID
- How do i fix this “call_user_func_array()” error
- How can I get the content of the current page in my loop while merging post-type
- wp_insert_post($post), add an array of values with update_post_meta
- Get user count based on multiple meta key values?
- update_post_meta adding to array instead of replacing value
- Add Array record to Meta Post
- How to output get_tags array list to select box
- How to avoid duplicate users when I am using get_users?
- How to add each letter, entity, special character from post title to array
- Strange Behavior with update_option
- wp_update_post to set post IDs to drafts not working
- How i can extract data
- Show Tags of Custom Post Type outside of Loop
- How can get all users by current user meta (array)?
- “Undefined variable: array” Error In Displaying Post Tag
- wp_set_object_terms not accepting variable array
- How do I pull post from standard post format?
- How to display checkbox meta array values one by one?
- Need help getting a certain value out of a multi dimensional array
- The writing ( with foreach) of the keys of an array of objects to a new array produces fatal error
- Create dropdown menu of all tags used in category
- Use $wp_customize->add_control to create a selectable “Designed/Powered By” choices select w/ link in footer?
- Echo the key from a select-box in Array with get_option (Settings API)
- update_post_meta array issues
- Update Post Meta for Arrays — Remove/Replace Single Value from Multi Dimensional Array
- How do I retrieve a value from a multi – dimensional array using get_post_meta? [duplicate]
- post custom values
- Accessing array elements (get_pages)
- Printing out JSON array returned [closed]
- Fatal error in my WP
- SQL query add only posts with custom field to array
- Combine two foreach Arrays into one table row
- How to match data in multidimensional array of post_meta_data?
- Populate Array with values from another arrray [closed]
- how to separate array with commas? [closed]
- JSON webhook WP Automator – Help with Syntax [closed]
- Multipe array in meta_input