Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It depends on how the meta data was saved in the first place. I never cared for the ability of saving multiple values for one user, all under a single key, so I’m unsure of what to do if that’s what’s happening. You’d probably have to get all values and sort out which to remove.

    If form data is obtained as an array, there’s no need to make it into a comma separated list. We can save PHP arrays directly to user meta. WP will serialize it for us and unserialize it for us on retrieval. Then you simply get the data and unset the undesired element and save the modified array back to where it came from.

Viewing 1 replies (of 1 total)
  • The topic ‘remove values within an array of user_meta’ is closed to new replies.