See this-
function check_values( $post_ID, $post ) {
$revisions = wp_get_post_revisions( $post_ID );
$revision_ids = [];
foreach ( $revisions as $revision ) {
$revision_ids[] = $revision->ID;
}
// $revision_ids; // holds all revision ids
// $revision_ids[0]; // latest revision
// $revision_ids[1]; //revision just before the latest one
}
add_action( 'publish_post', 'check_values', 10, 2 );
Related Posts:
- How can i disable auto save & revisions with `function.php` in wordpress?
- How to get post revisions in my custom rest API? [closed]
- Disable autosave with `function.php` for custom post wordpress?
- If click on Save/Publish change Post Status to Pending Review instead Publish
- Check if there is an post to be published in future
- Adding a second email address to a completed order in WooCommerce [closed]
- Advantages and disadvantages of using automatic-feed-links
- How to change the markup WordPress inserts for post images
- Change meta tags programatically
- Convert hyphen to underscore in permalinks
- Use a function to update post meta based on other post meta
- wp_mail not running inside Cron
- Remove product description from product archive page
- Logging in redirects to correct page but shows logged out content until forced refresh
- Adding body class when post contains a specific shortcode
- Displaying Widgets
- Display WooCommerce subscriptions for user [closed]
- Increment price for Woocommerce Minicart [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- Function to “Press Update Button” on all posts
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Check if row exists before inserting
- Missing argument 2 for a custom function widgets_init
- Removing the main link to Jetpack from the menu
- Defining a global array in functions.php?
- Get the 5 lastest Featured Posts from a category
- How To Remove Duplicate Menu Locations
- Set quantity of woocommerce product on page visit [closed]
- get_post_type() in in_array doesn’t work for some reason
- Is it possible to change any of the HTML/URL returned from the_category()
- Show top commenters without using a plugin
- How to remove set_post_thumbnail_size() in child themes?
- Post thumbnail not showing in WP admin area for custom post type
- Child theme within a child theme?
- Fatal error: Cannot redeclare when switching themes
- How to load jQuery in the footer – nothing works for me
- Featured Image Thumbnail Creation
- WP Ajax Function Always Returning undefined
- How can I grab the video id of youtube?
- Specify number of posts for sub-category page
- how to en-queue jQuery to load before the tag
- Passing variable as add_shortcode argument
- comments_popup_link without echo?
- Can’t filter wp_get_attachment_link
- Impossible to call wordpress function inside an include?
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Remove a category from a post when saving a new post
- Want to dequeue all the CSS and JS from /wp-content/uploads/xyz-folder
- add_action wp_enqueue_script priority level only works for admins
- Scripts not loading when using the wp_enqueue_scripts action
- is there a way to remove featured image from blog page and single page
- current_user_can comma list vs OR (||) list
- Include the post type before the title of search results
- Writing a function to detect an event
- Adding additional roles on registration
- add referrer to woo
- Problem with calling custom function in a foreach loop
- overwrite code snippet from parent to child theme
- Different methods of adding menu support to custom theme
- Function to insert missing image size attributes into img tags
- Redirects based on a JSON file
- Get Attachment Category Name
- Sort and display pages with specific custom field (not tag)
- Problem with custom function when I go back with the browser
- Creating multiple category drop down
- Disable trim in WordPress
- How i can get the URL?
- WordPress login set cookie that survive browser exit (wp_signon function)
- Show metadata in users.php – wordpress
- Add version # to wp_register_style function
- How to remove font awesome from loading in wp theme
- Customizing the wp_video_shortcode output with add_filter
- a SET of wordpress native galleries with title and text?
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Remove check boxes and its label from screen option for custom role
- Removing comment lines from all enqueued js files using a filter function
- Custom Function.PHP Code Not Working on One Site
- Only display table in the_content() in canonical page
- Button click counter for login user
- Auto copy value from specific user meta field to another field
- Route wordpress with template
- Change is_front_page() to is_page() to display ‘hero’ on entire site?
- Display page number on custom page title function
- different body classes for each category
- How to override or change function in form.php in a plugin
- Some code is added automatically to my site’s header – what is it?
- WordPress Javascript Widget jQuery Dependency Issue
- Open image size links in a page instead of direct image link
- Allow tags and attributes in post and pages content
- Override parent theme function that is not hooked or in the functions.php file
- Function to get thumbnail img source
- Syntax for a function in order to get post’s title in JSON encoded response [closed]
- Comment Function
- WP Custom Comment Callback Not Responding
- Do something when user creates post (that’s pending)
- Add product to cart from functions.php
- How I can show short content with short tag
- Get all users from role and add to dropdown (select) – wordpress, javascript
- Add functionality to block comment authors in the Comment edit pag
- WordPress enque the same script causes the setInterval not to work