This is the solution:
add_action('pre_post_update', function($post_id, $post_data) {
global $original_post;
$original_post = get_post($post_id);
}, 10, 2);
add_action( 'save_post_', function($post_id, $post, $update) {
global $original_post;
$original_post->post_title; // original post title
$post->post_title; // new post title
}, 10, 3);
Related Posts:
- what is correct way to hook when update post
- Check php version before theme activation
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- How to Remove a Filter from the Admin List Table?
- Hooking new functions to actions + passing parameters
- Find variables available at a given hook
- Delete option value from array using update_option()
- action hook wp_head higher priority as all other plugins/hooks
- Remove an action hook within a Class
- How to pass arguments to add_action() or retrieve return value of called function?
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Set meta field to publish date + 2 weeks
- Adding widgets to my plugin page instead of WordPress dashboard
- Adding function to Genesis genesis_header [closed]
- Modify custom field input data before creating a new post
- Should `wp_login` be used since it’s deprecated?
- How to catch wordpress post ID when it’s published
- WordPress redirect redirecting too many times or not at all
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- How to pass hook variable to function?
- How do I remove an action hook inside a class that is called by another class?
- Hook into all password resets in WordPress and get password before hashing?
- WordPress HTML Helper
- How to add custom checkout field in user details mail template
- Cannot modify header information – headers already sent
- Is there a hook that I can use when a fatal error occurs?
- Using register_activation_hook in classes
- WordPress and event-driven programming – what is it about?
- Does an activated plugin automatically mean its methods are available to other WP functions?
- Getting the action’s tag name within the action
- How to remove a metabox from menu editor page?
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- Action ‘save_post’ not working for quick edit
- add_meta_boxes action with refresh on save
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Insert post without actions/hooks
- Woocommerce, recognize the loop of related products
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Insert all post IDs in new database table
- How to add a second ‘place order’ button in WooCommerce [closed]
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- wp_loaded hook block script enquequing
- Ajax not working es expected (Returns 0)
- add_action shortcut?
- hook that when page is starting to load
- How to change home or site url using action hooks or filter?
- add element with add_action to posts from a specific category ID
- Remove metabox from WordPress menu editor page?
- Add a product to checkout via form
- Trying to place a custom field after the total section in the checkout page in woocommerce
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Why ajax doesn’t work on certain wordpress hooks?
- How to add an arrow to menu items has submenus
- Don’t insert if permalink is the same?
- Return a numerical function value in Customizer controls
- action theme mailchimp subscriber fields
- edit_comment_link is not showing for comment author
- jQuery code not working when included in functions.php
- add_action taking an array with the 2nd argument?
- Password minimum length in personal subscription [closed]
- Nested “do” and “add” Actions is possible?
- Theme activation hook in php class
- Why does the post_type_link hook everything twice?
- How can I hook into the wp_mail function used by BackWPup?
- Change image data durgin upload
- WordPress Post Block Element not properly parsed with the_content filter
- Filter wordpress posts without searching the keywords in the post content
- Display custom field value in woocommerce variable product via jQurey
- Use wp_head hook on template page
- remove_action from parent theme using child theme functions.php
- Adding custom field to product category and show it to shop/category shop page
- Preserving backslashes in post_content
- WordPress How do I pass a variable from one add_action to another?
- How to edit post meta data before publishing the post it self wordpress?
- Call a single function on two different methods with hooks
- get Woocommerce product format json for WP_Query
- Register/enqueue scripts only on certain admin pages
- Is there an option to execute javascript file only on plugin activation
- add_action in wp_head accessible from class
- Help hooking into user_register
- Why should I need to add init action to include PHP file to WordPress Plugin?
- Getting page / post URL on publish and / or update
- remove_action() not working in page template – Genesis
- How to hook into the subscriber /wp-admin/index.php page?
- Why transition_post_type hook is called twice for the same post?
- Add two or multiple functions in WordPress Post or Page
- Submit to itself don’t work
- How can I move the posted-on date above the post and below the entry-header?
- Post formating on Home page
- calling a function from a class in your template
- How does add_action ‘comment_post’ work?
- Custom action on comment post
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Change Checkout “Place Order” text if cart has a specific product
- transition_post_status hook, works – but not if the post is new
- php was updated – critical error [closed]
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- Woocommerce – add tracking code to another email template