You cannot use update_user_meta
on its own here. You would need to get_user_meta
first, decode your json into an array, update the last_seen
element of the array, re-encode it and only then update_user_meta
.
Unless there is a good reason not to, I would consider just saving these as serialized data (to avoid the json step), or even restructure your data to be more granular, saving each bit in its own record, eg with a key of 1_1_first_seen
, 1_1_last_seen
(where the first number is the user ID and the second number is the level) etc, as without this you’re making life very hard for yourself if you ever need to query any of this data in any detailed way.
Related Posts:
- strange issue with user_meta + json_encode/decode
- add_user_meta() vs update_user_meta()
- Get basic Image Uploader on User Profile Page
- Capabilities Vs User Meta
- Problem storing arrays with update_user_meta
- wp_get_current_user always returns 0
- get_users is expecting unserialized meta_value
- how to get specific fields from get_user_meta()
- Validating a new user registration field
- User meta to post
- Add profile field (usermeta) to Add New User
- very last action before during user registration before he is redirected to homepage
- How to Make admin Sidebar Menu always be Collapse by code
- get_users / WP_User_Query returns empty when logged out
- How to query users by meta value, even when meta key doesn’t exist?
- Add a member number to new user
- Hook or action to save profile fields at specific time
- How to get the user description with get_users?
- get current user not working
- No first_name or user_firstname property in WP_User object
- Possible bug: update_user_meta is updating two unique meta entries
- How to display current_user bio
- Is a user_meta research case-sensitive or not
- Store user’s registration date as meta
- How to tell whether a user meta value has increased or decreased [closed]
- update_user_meta() not working
- How to display user’s avatar on their profile page?
- WP_user_query throws a 404 error
- Incrementally add or substract from usermeta field
- set a user-meta key as avatar
- Prevent update of custom user profile meta field on the front end after 1st entry
- Inserting and finding multiple values in user-meta fields
- Update user meta on logout
- update_user_meta after wordpress in action hooks
- Adding user data to an existing user_id
- Problem to wp_hash
- trying to determine if meta value exists for user and if not auto submit gravity form to redirect
- action user_new_form param is a string
- Redirecting users based on custom user meta
- Customize Avatar using user meta
- get_user_meta returning old data
- Why does the usermeta table contain html entities?
- How can I programmatically show a specific (template) page, like author.php?
- WP_User_Query not returning users with meta – what am I missing?
- Multiple Email Addresses, One User
- Randomize Users
- “Select your country” landing page. Remember user choice
- How get meta from all users?
- Update user meta without lose of old data
- Using xprofile_insert_field
- How can I undo accidentally duplicated user metadata key values?
- Test if key is in user_meta array
- How to add to a user_meta field (append)
- Using WP for user management
- Show extra user profile meta for current user
- Pulling member name from WordPress URL
- If logged in user views his profile page
- how to search all user meta data that have value like “vivek”
- Add additional Fields for users and get value
- Getting a users username in get_user_meta
- How to get its meta_value of a specific meta_key within wp_usermeta
- How do i put in user id in a banner
- Remove fields from WordPress profile
- E-mail Update – Validation
- Update user meta array using foreach
- Can’t get the user_meta correctly
- How to save a label for an extra user meta field and to display it later?
- Display user meta data from a textarea as a formated text
- get random users each time based on the meta key
- How $_GET[‘updated’] variable is passed when updating a user?
- Wrong result in fetching User meta of WordPress
- How to display user_meta array as a table?
- how to get users with usermeta include array of an array
- Delete user meta ( delete_user_meta ) by key without user id
- Why is my Custom User Meta deleted on Profile Update?
- profile_update works on second update only
- How to remove the url format from the WEBSITE field in the user registry?
- users joined group count in buddypress
- Edit a user profile field on front end
- SQL – Shorter way to query user and usermeta data
- WP author meta disappeared
- How to set a user meta key value based on another user meta key value
- How to get value from radio buttons meta box, and return different contents?
- Changing an array of IDs in the usermeta table to fit different format
- Using wp_login vs login_redirect to redirect based on user-meta
- Saving an array of values (file urls) to update_user_meta()?
- Get currentuserinfo firstname and lastname
- Create a dropdown list displaying users meta data
- Get meta value and associated user meta
- Store Foreach in user profile
- use single form to enter multiple profiles
- Allow users to create and store data and retrieve it on login
- How to access User meta data within a plugin
- Using IDX feed to display agent’s and listings with agent’s info associated for Real Estate Website
- user profile replace first name last name with custom values
- Custom user meta data [closed]
- WPML – how to translate user profile fields with icl_t()? [closed]
- Creating a Digital Download facility and track downloads [closed]
- Find matches of a variable in custom usermeta
- get user id from custom user meta key