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.

Хуков нет.

Возвращает

null. Ничего.

Использование

block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post );
$new_status(строка) (обязательный)
The status the post is changing to.
$old_status(строка) (обязательный)
The status the post is changing from.
$post(WP_Post) (обязательный)
Post object.

Код block_core_calendar_update_has_published_post_on_transition_post_status() WP 6.0.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();
}