block_core_calendar_update_has_published_post_on_transition_post_status()WP 1.0

Handler for updating the has published posts flag when a post status changes.

No Hooks.

Return

null. Nothing (null).

Usage

block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post );
$new_status(string) (required)
The status the post is changing to.
$old_status(string) (required)
The status the post is changing from.
$post(WP_Post) (required)
Post object.

block_core_calendar_update_has_published_post_on_transition_post_status() code WP 6.5.2

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