I update Many Meta in current user and i want get all of meta
<?php
$new_user_id = 1 ;
$stats = test;
update_user_meta( get_current_user_id() , 'add-user-id-'.$new_user_id, $stats);
$new_user_id = 2 ;
$stats = test;
update_user_meta( get_current_user_id() , 'add-user-id-'.$new_user_id, $stats);
?>
How can I get Any Meta Like ‘add-user-id-[array of all users id ]’ ?
Example : I want List Of all Users Id saved in current user
2
Answers
From the current user ID you can get all its related metadata with
get_user_meta()
like:You can get all user_meta and then find the ones you need. For example, something like this:
Result:
array(2) { ["add-user-id-1"]=> string(1) "1" ["add-user-id-2"]=> string(1) "2" }