WordPress.org

Ready to get started?Download WordPress

Forums

get all users custom meta (1 post)

  1. hkaia
    Member
    Posted 9 months ago #

    i'm trying to get all users custom meta and merage it in array but i get an error

    $users = get_users(array(
        'meta_key'     => 'phone'
    ));
    foreach ($users as  $value) {
        $all_meta_for_user = get_user_meta( $value->ID );
        print_r(array_merge( $all_meta_for_user['phone']));
        $merged_array=array();
        foreach ($all_meta_for_user as $meta) {
            $merged_rray=array_merge($merged_array,$meta);
            // print_r(array_merge());
            //echo $merta;
        }
        var_dump($merged_array);
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

Reply

You must log in to post.

About this Topic