save_post hook not firing on changing post “stickiness” via quick edit

Question

when I hook to save_post like this:

function xxx__update_first_sticky($post_id) {
  if(get_post_type($post_id) === 'post') {
    xxx__set_first_sticky();
  }
}
add_action('save_post', 'xxx__update_first_sticky');

and I set new post to be sticky via quick edit this hook is not firing. Hovewer if I change something else apart from "stickiness" only in this quick edit, hook fires. But it’s not acceptable as I’m not making this website for me.

function xxx__set_first_sticky updates transient containing newest sticky post WP_Query object for performance purposes (I don’t want to make new WP_Query for this post on every page load). So I wan’t to run this function on every post save/update/delete etc. Its working in every scenario but not when post stickiness state is changed in quick edit :/

Any ideas how to hook to this quick edit "stickiness" change?

0
hayanawama 2 months 0 Answers 10 views 0

Leave an answer