Don’t do this if you have too many registered users on the site. Below is the edited portion from your code.
} elseif( ! $gone && ( $is_stats || $is_cm ) ) {
// we are in 3 days frame and trying to access to stats => redirect to post
// Start the code to send the emails
$subject="3 days have passed";
$users = get_users();
foreach($users as $user) {
$message="Hello ".$user->display_name.', '.PHP_EOL;
$message .= 'The 3 days have past since the post.';
wp_mail($user->user_email, $subject, $message);
}
// End the code to send the emails
wp_redirect( $pl );
exit();
}
Related Posts:
- Send email button in custom post type backend
- Send post changes to set email addresses (not users or subscribers)
- Send mail to author when custom post type is saved
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- Sort search results by post type
- how to group custom post types
- echo value from ‘select’ field type into page template using cmb2?
- Exclude add_filter from the admin
- Sanitizing post content for use in an email
- Custom post type without editor or revisions – Notify on update?
- How to auto send email when publishing a custom post type?
- How do I add a custom post type to the Featured Content in twenty fourteen theme?
- Saving multiple Metabox contents
- Is it possible to insert text into an html tag using functions.php?
- Custom post type loops with different page templates
- Multiple Content Block
- Unable to save or update postmeta for custom post type via action using save_post hook
- How to: add option to add more checkboxes on custom post type
- Comment Email Notification for CPT Comments
- Allow Users Access to Custom Post Type Only
- How do you output custom code between posts in the loop?
- How to use wp_mail in CPT page
- How to get Custom Post ID by adding filter to child theme’s function
- Sending an email when a CPT is saved/updated (NOT when it’s created)
- Output custom post shortcode. Help spot the error.
- When ‘is_post_type_archive()’ return true?
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- How To Enable Block Editor (Gutenberg) for Existing Post Type via functions.php
- Modifying Custom Post Type after registration (will it affect content?)
- Create a post in custom post type using field in registration form after users submit form
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- right_now_content_table_end function not working?
- PHP 8, AJAX mail form to function.php doesn’t work
- How to target a specific custom post type post and its all children and grandchildren?
- get_post_meta not working on publishing
- ACF field key/value to show on taxonomy list
- Re-registering a custom post type not working (not showing up)
- get_post_meta returning no value in custom post type alert email
- How to make custom posts types display when published for the future
- How to rewrite url for any specific taxonomy?
- CPT archive admin menu label
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- How can the recipients and content for comment email notifications on a custom post type be changed?
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Add term to custom post type on draft
- Different Category system needed for the Custom Post Type
- Template not working for the custom Post type
- Featured Image field not appearing in Custom post type
- Loop increase number
- ACF in wordpress
- Change Slug of a Custom Post Type
- List of all entries of custom-post-type: Add year-parameter?
- How to inherit field value from parent post into in child / sub post
- Custom post type’s posts are not showing anywere but in xml sitemap
- Removing full title and breadcrumb header container for a specific post type
- Show current user posts in custom post type query
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Custom post type in Custom widget – $listItem
- Function to erase every post from a taxonomy
- Redirect to URL if x number of days passed
- Display author box on just certain category posts?
- Conflict in function to allow single post template based on category
- redirect after submiting post for review
- How to divide Subcategories into pages of parent category wordpress
- set object terms after some some time of published post – functions.php
- update custom taxonomy custom fields
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Different number posts per page based on custom post type term id
- Pagination not working in custom post type. Help
- how to display author name in custom post type
- Urgent – WordPress keeps creating posts
- ACF field check value of field on all other articles
- How to get current post type?
- How to convert Post Object Custom Field into Tags
- Problem with multi checkboxes value in metabox?
- Create dynamic logo carousel without using any plugin
- Recovering data about custom post and taxonomy types
- wordpress does not see the correct custom taxonomy hierarchy
- is using “require_once” in wordpress theme affect the speed ???
- Duplicate posts in my custom loop
- How to sort custom post’s category by id from the theme’s function.php?
- Featured image in custom post is being disabled
- call_user_func_array() error after moving to another server
- WP_Query function for custom post type
- Modify shortcode to work with custom taxonomies and slugs
- Calling the first & last post by category in custom post type
- Query custom post type and showing its content
- Updating User Meta from Custom Post Field Upon Publish Not Working
- I want to split this into two functions
- Generate daily archive whenever any post type is added
- Invalid Taxonomy in template
- CPT Metabox with email notification
- Custom post type functions.php if statement on action
- Add HTML before a specific div?
- Emailing Authors only when a CUSTOM POST TYPE post is published- not when edited later [duplicate]
- How to create a job post by email parsing? [closed]
- Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected
- Send email on creation of custom post type and use get_post_meta()
- add_rewrite_rule not working with custom post type
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs