The easiest way is to tie into the WordPress action publish_post
. Here is a link to the codex with a basic example:
https://codex.wordpress.org/Plugin_API/Action_Reference/publish_post
Note: If you are looking to do this for a Custom Post Type, you’ll need to add an action for publish_custom_post_type
.
Related Posts:
- Hook that get’s triggered when the author of a post is changed
- the_author() returns empty string
- Prevent Authors from viewing each others Posts
- Sends out email to admin
- How to show list of posts by author and category?
- WordPress: How to get the current logged in author page URL?
- How to add editor’s name to entry meta byline?
- Different permalink for posts and authors
- How to display posts by current user/author in a custom page template?
- When a user creates a post (pending), send a confirmation link that allows them to publish
- Restrict the Number of Posts an Author can Publish (over time)?
- Search posts by post author name
- Get the user type of an author
- Show the title of the latest post by author
- Find most recent authors
- Show author post count in sidebar – Variable
- One comment per user email per post
- Get current users post URL?
- Get the author of the latest revision
- Filter posts by author and category simultaneously
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Custom function for “Submit for Review” hook
- Get all posts by post_author
- Send email to user that his post has been rejected
- Posting via email, where do I start troubleshooting?
- Multiple authors for single post without plugin
- Limit number of posts a user can make per minute?
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- Authors in menu, template list post by author
- Author must complete profile info before they can publish a post?
- WP rest api returns 404 only when author param is used
- How can I show wordpress posts based on author?
- Show info to author only
- Auto “expire” all of an authors posts on spcific date
- How to get the user meta data for a post?
- Receive each week the number of posts published
- Guest Author – How to display posts on /author/ archive page
- How can I show many posts an author has per week?
- Email entire post contents
- Whitelist Author of Private Post
- Show posts by a custom post author
- Getting the current author (it has changed) of a post, not the original author
- Display Notification Bar on Header on Certain Post Count
- How do I retrieve a users’ last 5 posts?
- obtain the author id given the post id
- Get all comments of author’s posts
- (solved) getting post author’s user role
- Send a review notification email to admin when a post is 12 months old
- Change all author links in Blog roll
- Display author’s name and avatar in post’s sidebar
- New Gmail email to a WordPress new post? [closed]
- static landing page leading to author specific pages w/ “live” content
- All Posts Linking to Author Posts directly
- Is it possible to lock all new and existing WordPress posts to one specific author?
- How to get the ability to change the author of a post
- Echo Text If User Is Logged in But NOT the Author of post
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- How to limit author related post listing ?
- Send email for pending post
- Restrict displaying posts to the poster itself (in Back-end)
- Get total post from an author
- How can I set a maximum allowed post size and number of posts submitted?
- Get x recent posts by author?
- Change Author Name to Sitename on Frontend
- Exclude a category of posts in author template
- Get latest author posts inside the loop
- Author Avatar as default first image
- Cannot select certain authors for posts after import
- Authors’ Links on Homepage Not Going to Author Post Pages
- Send email to admin with post author
- adding my posts (author posts) in menu
- Prevent 404 of Author pages without posts
- Restricting displayed posts to posts from only select authors
- Author post count in category
- How to Best Create Separate Subscribers and User Experience
- Change of author not updating
- Limit Post Creation Count by Author or Role
- Display post by Random Authors on Page Refresh
- What permissions does a role need for the user to be assigned as the author of a post?
- Post by Email – Shortcode for Language? [closed]
- Custom author search
- Changing the Category for all posts of an Author
- List of authors posts minus very latest
- show latest authors blog post
- Getting posts from multiple users?
- Display the current post author and his url in the post header
- Create a Page Template Which Displays All Posts by Current User
- Set the limit to allow author when make post!
- Show last post of employee in his profile page
- How to get single post by one author?
- Notify Author of the post if admin deletes his post and perform some function
- How to create a post based on data in a table?
- how to show all type of author posts in author page (SOLVED)
- Echo author slug in post edit page
- How to show total view count across all posts for an author
- How can I add Author’s phone number to wp profile and make it appear in wp-admin/edit.php columns
- Add author section on Author archive posts
- Look for one plugin which could send notification to any email when post publish
- users followin the blog post author