I'm trying to delete the custom user meta values but having no luck.

If I have just, say a value of 479 against a key of saved_properties, this I can do with simple delete_user_meta($user_id,'saved_properties','479');

But how if at all possible can I do the same if the values are serialized


Basically deleting or updating by the propID.

Is it possible and if so, any help would be appreciated.


It should be the same. WP's _meta functions handle serialisation for you.

  • As you rightly point out, WP handles the inputting of arrays (serializes) on saving, so, Unfortunately its not as simple as that as the meta_value is an array, so deleting the meta would need to be based on one array key matching with the argument.. eg delete from user meta where array key propID = 479. I managed to figure it out now, by looping through the array "saved_properties" and used unset to remove the match – Malisa Aug 10 '16 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.