WordPress Version: 6.1
/**
* Handler for updating the has published posts flag when a post status changes.
*
* @param string $new_status The status the post is changing to.
* @param string $old_status The status the post is changing from.
* @param WP_Post $post Post object.
*/
function block_core_calendar_update_has_published_post_on_transition_post_status($new_status, $old_status, $post)
{
if ($new_status === $old_status) {
return;
}
if ('post' !== get_post_type($post)) {
return;
}
if ('publish' !== $new_status && 'publish' !== $old_status) {
return;
}
block_core_calendar_update_has_published_posts();
}