As usual this may be a daft question, but how to I delete user meta based on key rather than user ID?
the standard:
I think needs a user ID.PHP Code:<?php delete_user_meta( $user_id, $meta_key, $meta_value ) ?>
As usual this may be a daft question, but how to I delete user meta based on key rather than user ID?
the standard:
I think needs a user ID.PHP Code:<?php delete_user_meta( $user_id, $meta_key, $meta_value ) ?>
You want to delete the user meta for all users?
correct. user meta with a specific key.
Short answer: you don't. Not with the standard calls.
bah, was beginning to think as much, thanks for confirming.
I'm at a loss at why you'd want to, though. Why do you want to?
You could write your own SQL to do it easily enough if you really wanted to. Off the top of my head, DELETE FROM $wpdb->usermeta WHERE meta_key = 'whatever' would do the trick.
Yeah, I'd rather do something like that straight up in the SQL. :)
why? tidying up on uninstall of a plugin.
But yeah the query is easy enough, but if the facility was already there I would have preferred to use it.