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)?
- Custom plugin: Trying to show saved data on frontend
- Remove Woocommerce product link
- Check php version before theme activation
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- How can I hook into and edit the text of a wp_nav_menu tag?
- Check if page parent has certain template
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Showing user ID on user main page from screen options
- Prevent publish status/date saved on transition_post_status hook
- Looping through WP_Post Object
- Is $hook a global variable in WordPress
- Using a javascript file to access a get posts array
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Getting my head round WordPress filter
- get_usermeta() deprecated in favor of get_user_meta(). But why doesn’t it make use of it?
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- How to set a custom path, for ajax image upload folder in admin?
- Check if term object is in array
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- Create a new usermeta field for users
- How to get a list of all possible values of a specific user meta key?
- How do I display a user’s previous orders as a select box option on a product?
- Handling Body class based on Template
- Remove duplicates – array_unique()
- How to load a template-part based on a url wildcard?
- Recent posts with featured image or fallback image with permalink
- Storing Array from returned database query and using the array in a new query
- How to use an associative array in post__in with WP_Query?
- ajax, right way to do it and make it works?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- function to assign user role based on a field from usermeta
- Reload part of checkout on changed shipping method
- Trying to build simple deposit code that hooks into woocommerce
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- user_profile_update_errors hook not executing
- Adding number to date not working [closed]
- Set meta field to publish date + 2 weeks
- WordPress Gravatar filter is removing my custom attributes
- Adding widgets to my plugin page instead of WordPress dashboard
- Exclude posts based on meta value
- Modify custom field input data before creating a new post
- 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
- How to use a custom hook
- wp_force_remove_style’ not found
- Run a code only on theme activation only during first activation
- How can I access string value in an array?
- Filtering a function’ output for a new continued function
- Theme not calling Jquery properly
- WordPress redirect redirecting too many times or not at all
- How to say if meta_value is greater than 0 in an array?
- Get user custom field value on function.php
- I’m unable to call img path using single quotes in an array?
- Separate array output into a
- Must filter functions receive all arguments passed to them?
- add the value of a variable returned in a while loop [closed]
- Update value of a associative array with update_post_meta
- Update user repeater meta (ACF) with another user meta field value
- MySQL Query Returns Array () In Shortcode
- Generate a QR code when creating a new WordPress user
- Convert a column of a table containing an Array as response in HTML
- Filter wordpress posts without searching the keywords in the post content
- Variation prices breakdown only for single product page
- Create an array with all the links of the years’ archive (of a custom post type)
- Redux option doensn’t seem when include from functions.php
- Add custom field on admin dashboard comments / reviews
- User meta needed in query is serialized – how to unserialize safely?
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- Preserving backslashes in post_content
- Display one random image from Media Library
- Enqueue assets from multiple directories using add_action/do_action
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Call a single function on two different methods with hooks
- Discount in the specific product title using keyword ( Woocoommerce )
- Update an additional user meta field with a string
- get_category_parents to array
- Right way to display the_author_meta fields?
- Adding user meta to post meta wp_insert_post() not working
- How can i iterate through this shortcode array?
- Passing link parameter values to form
- Non-array argument in array_merge()-function [closed]
- Showing all post from all post type in admin backstage
- How to add custom checkout field in user details mail template
- Use php array outside his function
- For each loop will not append to the_content hook
- Retrieve Array from within Array [closed]
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- Import users and custom user meta from csv
- understanding wp_next_scheduled
- How to group by column a and sum column b and c in a php array
- Guests comment form – prevent duplicate email addresses