add_action('future_to_pending', 'send_emails_on_new_event');
add_action('new_to_pending', 'send_emails_on_new_event');
add_action('draft_to_pending', 'send_emails_on_new_event');
add_action('auto-draft_to_pending', 'send_emails_on_new_event');
/**
* Send emails on event publication
*
* @param WP_Post $post
*/
function send_emails_on_new_event($post) {
$emails = "[email protected], [email protected]"; //If you want to send to site administrator, use $emails = get_option('admin_email');
$title = wp_strip_all_tags(get_the_title($post->ID));
$url = get_permalink($post->ID);
$message = "Link to post: \n{$url}";
wp_mail($emails, "New post published: {$title}", $message);
}
Related Posts:
- How to prevent a post from being deleted?
- Limit access to posts/pages by user roles
- Enable comments for post with comments meta box removed
- How to allow an editor to edit all WordPress blog posts but have the last say as administrator?
- Notification When Post Approved
- Notifications on WordPress Website [closed]
- Notifications Bar on home page only
- Show the author only own types of publications. (JetEngine, Elementor)
- Disable update notification for individual plugins
- Manually set global $post vars with an ID, in order to use template tags
- Show a different number of posts per page depending on context (e.g., homepage, search, archive)
- Disable email notification after change of password
- How can I make it so the Add New Post page has Visibility set to Private by default?
- Deactivate plugin for a specific user group
- How to moderate posts
- Publish author posts only with editor approval?
- How can I modify the Capability needed to access a plugin’s options?
- Send email when a new post is published [closed]
- Show Similar Post Titles ( Similar to Stack Exchange )
- How to add option box in “Edit Post” plugin API?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- How do I unlock a post programmatically?
- How to work with Syntax Highlighter Evolved?
- User-Specific Timezones? Hack? Plugin?
- Disabling Comment Notifications for Post Author
- Delete Post With No Traffic?
- WordPress Capabilities: edit_user vs edit_users
- How to Add jQuery Infinite Scroll to My Custom Archive Page
- Automatically Creating Posts for Popular Forum Topics or Products [closed]
- Let readers suggest edits from the frontend
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Disable text tab on WordPress text-editor
- Allowing Custom Capability to Manage Plugin Options
- jQuery plugin only in one page/post
- Disable plugins for a specific user role
- User profiles and object associations
- Disallow a user to post in certain categories
- How to assign user a role if none is present when logging in
- How To Ignore a Filter On Applying Filter the Content In a Function
- How to notify users of blog updates a la Admin Plugin Update notifications?
- Auto-post to multiple sites like Posterous? [closed]
- Article source link for posts
- publish_post hook isn’t working for scheduled posts
- How to get posts by content?
- Share buttons on article footer
- How to create a Page alias in WordPress
- Plugin for changing a post’s category based on it’s post date?
- Woocommerce: change user role after completing order
- Specific post user permissions
- Don’t send notification if author comments his own post plugin help?
- How can I let users to access plugin functions based on roles?
- Publish Post After Click On A Link
- WP get_permalink Return Wrong URL
- Dynamic homepage according to user role
- How to extract images of post and pages excluding header and logo image in wordpress?
- Dynamic HTML not displaying at respective place
- Fastest way to loop through all posts?
- Get the last post ID
- Restricting users to a specific front end page [closed]
- Remove Adminstrator Hyperlink from a user having role to add and see users
- Restrict backend but allow to use post.php?action=delete&post=POSTID from front-end
- Edit/revise option for authors to suggest improvement to posts [closed]
- Is there a plugin to display certain posts on certain pages? [closed]
- Custom Post Type causes Page Not Found
- Checking for user role in a custom plugin
- Unique post-id for WordPress Multisite Network
- How can I change plugin to give access to editor user role?
- Is there an action that is called when a post is restored from the trash?
- WordPress roles – Protect administrator role
- wordpress custom login successful redirect hook
- plugin for wp_list_categories with posts
- How to filter content post only on save
- post expire after x days
- Action on post publish
- Replace existing pages with new pages, keep menu links
- Adding “ ” before the last word in multiple defined areas with a plugin
- [Plugin: Posts 2 Posts] How does it work?
- Allow Facebook to preview posts before published
- PGP-Encrypt system-generated notifications
- Set attached to state
- Use plugin or custom post type for game score functionality
- Tag link suggestion plugin
- How to add new tabs in post.php
- How to change ID of an attachment in wp_posts and its related tables correctly?
- Collaborative post submission [closed]
- Keep user’s privileges on accessing contents in JSON response
- CKEditor: Uncaught TypeError: switchEditors.switchto is not a functiononclick
- New post notification plugin [closed]
- Is there plugin to show recent posts from one website in the widget area of another?
- Bulk Image Uploader to create new post from each image [closed]
- How use %like% in sql statement wordpress
- Display comments of users on single page
- Advanced Custom Fields/User Role Editor – how to hide ACF for certain users?
- Get the url of the full sized attachment image using post ID?
- Adding Plugin-specific Fields with wp_insert_post()?
- How create a role with admin capability less 1 or 2?
- Adding Attachment Display Settings in custom media frame
- Set user ID at time of wp_create_user
- Output HTML only on individual post view
- Using the “Latest posts” feature on a different site