It sounds like you’re looking for the publish_post
hook which (per the Codex):
Runs when a post is published, or if it is edited and its status is “published”. Action function arguments: post ID.
Alternately, there’s save_post
which is
triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email.
Related Posts:
- add action only on post publish – not update
- How to add a “publish” link to the quick actions
- How to run a function when post is edited or updated using publish post action?
- Copy post to separate database with “add_action(….)”
- Send email to user when I publish a new post
- How to add publish button in menu All Posts (Wp-Admin)
- Is there a action hook for the “Empty Trash” button?
- Function to execute when a post is moved to trash .
- How to prevent posts from being published too close to each other?
- How to validate XML-RPC post creation and cancel when needed?
- Is it possible to Schedule Attachments in WordPress?
- Create posts on user registration
- Elegant way to include only published posts with get_objects_in_term()?
- How to publish a post with empty title and empty content?
- WordPress plugin to publish to multiple remote WordPress blogs
- Post publish only hook?
- Publish pending article from front end with a button?
- Action hook ‘wp’ firing twice… why?
- How to limit user to publish post per day and per role?
- When a user creates a post (pending), send a confirmation link that allows them to publish
- In what sequence are the hooks fired when a post is “published”?
- Restrict the Number of Posts an Author can Publish (over time)?
- Add javascript when post is published
- Count singular post views automatically
- featuring old articles without messing up with the archive
- Publish posts only after the condition is met
- Hiding by default specific post status on backend list?
- Detect Post Type when publish_post is ran
- Get the post_id of a new post
- Custom function for “Submit for Review” hook
- How can I display a specific user’s first published post?
- Does WordPress remove draft status automatically?
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Prevent post from being published if no category selected
- Send email to user that his post has been rejected
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- Action on post publish
- Limit number of posts a user can make per minute?
- How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?
- Every possible way to get data (posts) from WordPress
- publish_post conflicts with save_post
- add_action not using ‘delete_post’ action with wp_delete_post
- the_posts filter been called multiple time
- Get post id in wordpress action?
- How can i do something after head like adding a hook for after head but before post
- Notification to Admin or Author upon new post [duplicate]
- What differences are there between a Privately Published post and a Draft post?
- How can I create custom button in post.php
- Create cron job without a plugin?
- How to generate numbers indistinguishable for the IDs of the posts
- How to rename “Publish” metabox title in post screen
- count the total number of comments the user has received for his published posts
- Automatically Updating Publish Date Bug
- How can I schedule a PAGE to go live at a future date/time?
- How to give capability (publish contributors posts) to author role?
- Print a message if excerpt is empty after posts have been publish/update!
- Adding custom fields to bbpress reply form
- Check if checkbox is marked on publish/update post
- Adding buttons to Add New Post and Add New Page
- Decide user that can publish a post
- How to switch wordpress post status between publish and schedule in MySQL?
- How to access $post from a callback function
- Prevent scheduled post being published if date/time is past current date/time
- Calling Different Custom Post Timestamps in a table
- Set static page/post from another blog on same network
- Do action on publish or update?
- transition_post_status hook doesn’t have any POST data when publish with Gutenberg [closed]
- How do I manage my users post before publish?
- Call Web Services on post first publish
- How to check if single.php has already called the_post_thumbnail function
- do more action after I publish a post
- What does WordPress do if I save a post without content/title? [duplicate]
- Assign published posts to another user automatically
- Divs appearing everywhere in post content
- Display password protected posts to logged in users
- Stop wordpress from creating empty/null entries
- WordPress bulk category select when publishing post
- Prevent posts with certain post_meta to be edited
- How to check in functions.php if there is data in a WP_Query?
- Update post meta within save_post action
- Automatically set post_parent value
- how to execute some code after a post is published in WordPress [duplicate]
- How can I tell if a post has been published at least once?
- Send email for pending post
- Post: how to set created date after post has been published [closed]
- Add delay to publish post
- Exists filter or action that change Add New Post link?
- Publish a Silent Post without updating Feed
- How can my plugin display a populated new post window
- Actions to use when flushing cache (when posts are added / deleted / modified)
- Is there a way to know when a page has been updated and do some action only once?
- How to set a Post’s default visibility to ‘Private’ in Gutenberg?
- WordPress doesn’t save or publish new posts
- Run a function when a custom post is update?
- the wp_post_update isn’t working all the time
- Hook when post is set from published to draft?
- Is update_post_meta used when save_post action hook is invoked?
- My posts are getting to Auto draft when I try to Publish
- How to publish a post if condition is met?
- WordPress get tags in “publish_post” hook