I’d like to create a button for admins to be able to delete from table wp_usermeta -> key: ‘ref_credit’ for all users.
Is there simple resource friendly way to do this? does wp have built in function for this?
I found this: http://codex.wordpress.org/Function_Reference/delete_user_meta
But this is only for single user.
This is a super old post, for all you future readers, you can use the delete_metadata()
function to achieve this with a lot less DB overhead:
delete_metadata(
'user', // the meta type
0, // this doesn't actually matter in this call
'my_meta_key', // the meta key to be removed everywhere
'', // this also doesn't actually matter in this call
true // tells the function "yes, please remove them all"
);