is it possible to use get_field()
to get the email of a user ?
I cannot make it work : get_fiel("user_email", "user_".$user_id)
returns null, and get_fields("user_".$user_id)
returns an object that does not contains the field user_email
however, using the wp function get_userdata($user_id)->data->user_email)
give me the right result
Maybe get_field()
only works for acf fields ? that would make sense, but in the other hand the documentation page says ‘this function can be used to load the value of any field from any location’ https://www.advancedcustomfields.com/resources/get_field/
I wanted to use get_field()
because it was easier to have only one way to do it, otherwise I should check if the field is an acf field before maybe ? How can i do that ? Simply if get_field()
returns null ?
And also, I was wondering if get_field()
was maybe more secure than get_userdata()
?