Support » Developing with WordPress » remove values within an array of user_meta

Viewing 1 replies (of 1 total)
  • Moderator 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)
  • You must be logged in to reply to this topic.