Skip to content

Instantly share code, notes, and snippets.

@zourbuth
Created October 17, 2012 07:39
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zourbuth/3904247 to your computer and use it in GitHub Desktop.
Save zourbuth/3904247 to your computer and use it in GitHub Desktop.
Get All WordPress User Meta Keys
<?php
/**
* Returns all unique meta key from user meta database
*
* @param no parameter right now
* @retun std Class
* @todo do what you do for each meta key.
*/
function get_user_meta_key() {
global $wpdb;
$select = "SELECT distinct $wpdb->usermeta.meta_key FROM $wpdb->usermeta";
$usermeta = $wpdb->get_results($select);
return $usermeta;
}
@devidw
Copy link

devidw commented Jan 22, 2022

Thanks for the function, works great. 🤙

What do you think about @return stdClass[] as return comment line instead of @retun std Class?

@mehdi-eybak
Copy link

Thanks for the function, works great. 🤙

What do you think about @return stdClass[] as return comment line instead of @retun std Class?
Hey, if you don't want stdClass to return, check this out :
https://gist.github.com/mehdi-eybak/7a17e022e73f8a9f73e016958e29bb8a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment