I have phone call details being added to corresponding user's meta data via webhooks (using wp-webhook plugin). The output is an array as data is always being added. For some reason only the first value is being shown on the front end. Below are 2 separate methods I've tried and neither show all of the data. I am also using PHP Code Snippets plugin (not sure if this has anything to do with the issue). The output meta data from the webhook shown in the user's profile looks like this:
//output data
array (
0 => 'phone_data 1',
1 => 'phone data 2',
2 => 'phone data 3',
3 => 'phone data 4',
4 => 'phone data 5',
5 => 'phone data 6',
)
//get and display user meta
$current_user = wp_get_current_user();
if ( $current_user ) {
$meta = get_user_meta( $current_user->ID, 'phone_calls' , true );
if ( ! is_array( $meta ) ) {
$meta = array();
}
echo 'User phone calls: ' . $current_user->phone_calls . ;
}
// Also Tried this:
$current_user = wp_get_current_user();
echo 'User phone calls: ' . $current_user->phone_calls . ;