WC_Admin_Profile::get_user_meta() protected WC 3.1.0
Get user meta for a given key, with fallbacks to core user info for pre-existing fields.
{} Это метод класса: WC_Admin_Profile{}
Хуков нет.
Возвращает
Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_user_meta( $user_id, $key );
- $user_id(число) (обязательный)
- User ID of the user being edited
- $key(строка) (обязательный)
- Key for user meta field
Список изменений
С версии 3.1.0 | Введена. |
Код WC_Admin_Profile::get_user_meta() WC Admin Profile::get user meta WC 4.9.1
protected function get_user_meta( $user_id, $key ) {
$value = get_user_meta( $user_id, $key, true );
$existing_fields = array( 'billing_first_name', 'billing_last_name' );
if ( ! $value && in_array( $key, $existing_fields ) ) {
$value = get_user_meta( $user_id, str_replace( 'billing_', '', $key ), true );
} elseif ( ! $value && ( 'billing_email' === $key ) ) {
$user = get_userdata( $user_id );
$value = $user->user_email;
}
return $value;
}