Got the below array result from the get_user_meta()
WordPress hook
Review the array
Need to check value of all val
key whether its value is 1 or not.
The get_users()
array have the values :
Array
(
[0] => WP_User Object
(
[data] => stdClass Object
(
[ID] => 1
[user_email] => [email protected]
)
)
[1] => WP_User Object
(
[data] => stdClass Object
(
[ID] => 2
[user_email] => [email protected]
)
)
)
get_user_meta()
array values:
Array
(
[0] => Array
(
[first_name] => Array
(
[0] => john
)
[val] => Array
(
[0] => 0
)
)
[1] => Array
(
[first_name] => Array
(
[0] => mark
)
[val] => Array
(
[0] => 1
)
)
)
Need to take value of email
from get_users()
where get_user_meta()
val
== 1
I have tried this below solution but can can not get result.
$is_val = array_search(1,array_column($users,'val'));
if($is_val == 1) { wp_mail($to,$subject,$message,); }