You’re looking for the save_post
action. This allows you to add a function when a post is saved (updated).
You can hook into it like this:
function your_save_post_function( $post_id ) {
}
add_action( 'save_post', 'your_save_post_function' );
Remember to not change WordPress Core files, as these will be overwritten when WordPress is updated. You can put this code in your functions.php
file, or anywhere else in your theme folder.
Related Posts:
- Action on post publish
- How can I make it so the Add New Post page has Visibility set to Private by default?
- Publish Post After Click On A Link
- Is there an action that is called when a post is restored from the trash?
- How to filter content post only on save
- Function added to hook “new_to_publish” not executing – custom plugin
- trigger email when post is published by someone a user follows
- What hook can I use to modify custom post data before it is displayed on the page?
- How to write a new file when new post has been published in WordPress
- Add new post using a page inside the website
- Add custom button to the changeset status in the Customizer
- How to Get Recent 5 post in My Title bar?
- How to get Recent Post From Each Category with Thumbnail?
- Plugin for visitors to edit content without logging in? [closed]
- How do I allow users to supply a photo/image to be used instead of the grey/white silhouette?
- help intercepting save_post through plugin
- WP Insert Post If user refreshes override new post
- Summary and Comments on Main landing Page
- Edit post image attributes on fly?
- Method/Plugin/Hack to Start a Post with an Writing Outline?
- Update existing post dates to random dates and time
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Displaying page content from plugin, inside exising empty WP page
- Why the internal link get converted into a comment?
- Is it possible to pin a post in second position from top
- Hook from plugin doesn’t fire up from external PHP script
- Oops! That page can’t be found
- page duplication on wordpress that wont stop
- Copy/paste local images not working in WordPress
- Help to Create a Simple Plugin to make a post
- How to change my 3000 Published post status to Draft using PHPMyAdmin
- New posts are not showing up on my front page
- WordPress is redirecting me to homepage
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- update_option_{$option} not working (do function after options are saved)
- Adding custom post category to categories widget
- How to display the custom post related blog by category?
- WP Forms not displaying,becomming an fatal error
- Callback hooked to post_updated firing on new posts as well
- Randomize post (and page) IDs on generation
- Moving all wordpress posts from 50 websites to another website
- WordPress hide post from custom post-type on a single page
- Why do actions with class and public method don’t fire __construct()
- The function called on the wp head hook becomes null
- i create functions.php in plugin files but add_action (‘wp_head’, ‘function_name’) don’t work
- Sharing varible between two add_actions
- Send email to user when I publish a new post
- Hooking into the HTML header container
- Discern a specific plugin’s action hooks
- How can I see $post object in frontend from functions.php?
- Show post object of any page in frontend
- .com creates automated link in post
- Allow members to create groups on my site
- Trying to add a new feature in my wordpress website
- Powerpress upload a podcast without creating a post for it
- How to remove default action from a plugin?
- automatically set random featured image by category in wordpress on post
- Removing Plugin Action via Theme for Non-admins
- add tags to wordpress post using REST API
- How to Unhook actions/filters in within Class in plugin
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- WPML – Hook when language is switched (change user language)
- Nested Actions and Filters
- Use action, filter, or hook to append HTML to WordPress plugin function
- Pagination (including title of each page) in a post for a long posts
- Passing function into add_action always returns the first argument
- How to make a page both “private” and “password protected”
- Failed to load resource: the server responded with a status of 500 () post.php
- Get post content inside plugin class method
- How to echo a PHP Code After the Content
- All Post WordPress Page Error
- WordPress Product Detail and catalog
- Ajax call to php function doesn’t work PHP code
- Remove action added in plugin class from theme
- {status}_{post_type} does not run correctly?
- How to upload PDF from Front-End and post automatically?
- Is it possible to create duplicate post on other site (either push, on publish, or pull, periodically)?
- How to wrap image tag into div for post only?
- Change hook to add_action in a plugin class
- Frontend AJAX Request causes Error: ‘Call to undefined function add_action’
- How can I get the Post ID and Post Type within a Must Use Plugin?
- WordPress CPT Url metabox collection
- echo plugin results on pages
- Creating Admin Submenu Page via Class Method
- How to get bulk actions handler to display simple “Hello World”?
- Get value from an input field and pass into update_meta_data as $meta_value
- Help needed with woocommerce (wc stripe) filter
- Why is WP template_include overwritting all templates rather than specified page?
- What action or filter can I use to change all the html returned from server for a page?
- Identify if the_post hook is being called from the admin post list
- What action/hook do I need to register to have my plugin handle front-end editing?
- My own metabox checkbox plugin only saves the last value I’ve checked
- Get content and send to 3rd party
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- wp_login_form() ignoring login_form action hook
- How to prevent authors from editing their post count?
- Do something with thumbnail image on post publish
- Add dynamic color to each category item