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?
- how to make custom ajax handler?
- Are all hooks/functions tied to Kses meant for sanitization?
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- jQuery code not working when included in functions.php
- Why does wp_head hook my functions to the beginning of my source code?
- add_action taking an array with the 2nd argument?
- Pass argument to event hook
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- How to show a users bio on a page
- Override a function defined in wp-includes/comment-template.php
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Password minimum length in personal subscription [closed]
- How to use a custom hook
- Nested “do” and “add” Actions is possible?
- Run a code only on theme activation only during first activation
- Change order of custom submenu link in WP Admin?
- Theme activation hook in php class
- Theme not calling Jquery properly
- Are there action hooks for comments?
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- Get access to variable from previous pageview, excluding ajax-calls
- Why does the post_type_link hook everything twice?
- How to have different site identity logos on each page on Astra Theme [closed]
- How can I hook into the wp_mail function used by BackWPup?
- How to pass argument to add_action while the method is inside a class?
- Display attribute on shop page after the title
- Get user custom field value on function.php
- Send notification email to admin for every new post published
- Adding function to child theme’s function.php
- Comapare get_user_meta value
- Action Hook Inside WordPress Plugin Shortcode
- Dynamically adding filters
- Woocommerce custom Plugin in wordpress [closed]
- Add a custom class to the body tag using custom fields
- Must filter functions receive all arguments passed to them?
- Why doesn’t global $wp_query not get hooked?
- Creating customized php files in theme folder
- Dynamically Generate Functions and Hooks
- Change image data durgin upload
- save_post trigerred twice
- How to sort WooCommerce products page by latest in-stock items first?
- Generate a QR code when creating a new WordPress user
- Replace a single variable with add_filter
- WordPress Post Block Element not properly parsed with the_content filter
- Filter wordpress posts without searching the keywords in the post content
- Variation prices breakdown only for single product page
- Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
- How do I add a function to parent theme
- Display custom field value in woocommerce variable product via jQurey
- Prevent header and footer from loading on specific pages with template or plugin
- Remove an action created by a Gravity Forms add-on
- Add custom field on admin dashboard comments / reviews
- Contain multiple page templates in one PHP custom template file in WordPress?
- Show full post instead of excerpt
- Use wp_head hook on template page
- Wp_Schedule_Event every few minutes doesn’t work
- remove_action from parent theme using child theme functions.php
- Use PHP Class in WordPress functions
- 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?
- Trouble Accessing Gravity Forms API (GFAPI)
- How to edit post meta data before publishing the post it self wordpress?
- Hooking into the HTML header container
- Enqueue assets from multiple directories using add_action/do_action
- I want to hide “sold by” on certain pages with id page 43
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Fatal error: Uncaught Error: Class ‘WP_Block_Styles_Registry’
- Call a single function on two different methods with hooks
- Custom meta box is not displaying value showing tag as empty
- using filter and hook inside class
- Discount in the specific product title using keyword ( Woocoommerce )
- get Woocommerce product format json for WP_Query
- Register/enqueue scripts only on certain admin pages