block_core_calendar_update_has_published_post_on_transition_post_status

The timeline below displays how wordpress function block_core_calendar_update_has_published_post_on_transition_post_status has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

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();
}

WordPress Version: 5.9

/**
 * 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 (is_multisite()) {
        return;
    }
    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();
}