You can use meta_key or meta_query to fetch users where get_user_meta() ‘val’ == 1
Option 1:
$users = get_users(array(
'meta_key' => 'val', // your_meta_key
'meta_value' => '1', // value you want to compare
'meta_compare' => '=',
));
Option 2:
$args = array(
'meta_query' =>array(
array(
'key' => 'val', //your_meta_key
'value' => 1, // value of key to compare
'compare' => "="
),
)
);
$users = get_users( $args );
You can run through the loop to get email address of user and send email.
Related Posts:
- If Array Values Match Another Array’s Values, Then
- How can get all users by current user meta?
- Store custom field’s multiple values in one user meta key
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- get_users when from meta key that has serialized values
- How can get all users by current user meta (array)?
- edit_comment_link is not showing for comment author
- Let Users Choose Post Categories
- Adding function to Genesis genesis_header [closed]
- Modify custom field input data before creating a new post
- Update user profile information from functions.php
- how to make custom ajax handler?
- Checking array against author id in loop
- Are all hooks/functions tied to Kses meant for sanitization?
- Alter required message using comment form api
- Why does wp_head hook my functions to the beginning of my source code?
- Pass argument to event hook
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Should `wp_login` be used since it’s deprecated?
- a:0:{} is replaced into database as s:6:”a:0:{}”;
- Advanced Custom Fields – display label and value only if value entered
- meaning of (array)function()
- Grouping posts by a custom meta value
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Password minimum length in personal subscription [closed]
- How to use a custom hook
- wp_force_remove_style’ not found
- Run a code only on theme activation only during first activation
- Read array in php?
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How can I access string value in an array?
- Theme activation hook in php class
- How to use if statement in an array? [closed]
- How to array only one key from another array
- Filtering a function’ output for a new continued function
- Get html data with javascript to php array and store to wordpress database
- How do I create a numbered list with PHP? [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Theme not calling Jquery properly
- Countdown to date function?
- How to use array in function to get only value I want
- Error while setting role
- Get categories names as an array to use it in theme settings
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- Get access to variable from previous pageview, excluding ajax-calls
- How to catch wordpress post ID when it’s published
- WordPress redirect redirecting too many times or not at all
- How to get the last category name of a child category?
- How to say if meta_value is greater than 0 in an array?
- Getting users with a specific meta data and then querying their posts?
- Why does the post_type_link hook everything twice?
- How to use two meta_compare in an array?
- How to update and save user metadata on page visits?
- Warning: in_array() null given in PHP function
- Foreach loop inside an array_merge
- Login redirect. Check user meta and redirect accordingly
- Loop over Array and get the distinct ids
- How to access or parse key/values that have “string”
- User Meta Value not echoing despite Var_Dump Showing correct string
- Remove empty terms from array, sort alphabetically, update back to repeating field
- How to have different site identity logos on each page on Astra Theme [closed]
- How can I hook into the wp_mail function used by BackWPup?
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Only show first image in foreach loop
- Shortcode for Listing Users from Meta Value?
- Conditional multidimensional arrays and array_map
- Getting different user data depending on where I use variable
- Get user custom field value on function.php
- How can I get all values from my array in a loop in php? [closed]
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- Adding Author Box Meta Links with Co-Authors
- I’m unable to call img path using single quotes in an array?
- Filter by field with array value in ACF on WP REST API
- Get the users that my following users are following
- extract serialized array to use for wp-query
- Send notification email to admin for every new post published
- Adding function to child theme’s function.php
- get users search not working with array
- Get the id of all images in a post
- Output category list inside array
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- Multidimensional Array
- Separate array output into a
- array_rand not working correctly?
- Get css class of menu item in custom menu structure
- Dynamically adding filters
- Order a WP_Query by meta value where the value is an array
- Edit Account – read and write to MySQL
- Add a custom class to the body tag using custom fields
- Must filter functions receive all arguments passed to them?
- Why doesn’t global $wp_query not get hooked?
- Only load certain artists on this page
- add the value of a variable returned in a while loop [closed]
- Creating customized php files in theme folder
- Dynamically Generate Functions and Hooks
- Update value of a associative array with update_post_meta
- How to make sure relative URL works when site is not on root domain?