Is there a For/Loop available to display all the available WordPress User Custom Meta Data so that when on the user.edit.php screen you can see and update all custom metadata? I understand methods exist on a per item basis.
1 Answer
Two ways I can think of:
you could use a MySQL statement to get all usermeta matching an ID in the wp_usermeta table. That would get the custom meta as well, but it would also get other user settings that I don't think you want.
The other way is to define an array with all your custom data and loop through the array with a FOR loop.
For example:
$custom_meta = array("middle_name", "hair_color", "ear_size");
$userID = 1;
for($i=0;$i<= count($custom_meta), $i++){
echo get_the_author_meta($custom_meta[$i], $userID);
}
I might be wrong, but I don't think there's a relationship in the WP db that defines whether a metadata is custom or not. So that's why you need to build the array beforehand.