I am saving posts by the current user's name. Furthermore, I am saving an array object - $ganalytics_settings - to the post in a custom field. With the following code I am trying to load the array for the username, with a specific post title:
function get_custom_field_for_current_user( $customFieldName ) {
$current_user = wp_get_current_user();
global $wpdb;
$id = $wpdb->get_row("SELECT ID FROM wp_posts WHERE post_title = '" . $current_user->user_login . "' && post_status = 'draft' && post_type = 'post' ", 'ARRAY_N');
return get_post_meta((int)$id[0], $customFieldName);
}
However, I am getting back the following object:
Instead I would like to get back the following:
Any suggestions why my function gives me back an array in array?
I appreciate your reply!

