I am using WooCommerce Subscriptions (custom post type), and want to run a custom function when a subscriptions is updated through WP-admin. For that I am using the following Wordpress function:
add_action( 'save_post_shop_subscription', 'lh_admin_subscription_updated', 10, 3 ); function lh_admin_subscription_updated($post_ID, $post, $update) { $subscription = wcs_get_subscription( $post);
The problem is when I get the subscription from the $post variable, it gets the details before the update. And that doesn't help me much, as I need to get the changes that was made cause I am going to use this in a custom function.
How to get the changed details for a post object when using save_posts_
?