wpseek.com
A WordPress-centric search engine for devs and theme authors



block_core_calendar_update_has_published_post_on_transition_post_status › WordPress Function

Sincen/a
Deprecatedn/a
block_core_calendar_update_has_published_post_on_transition_post_status ( $new_status, $old_status, $post )
Parameters: (3)
  • (string) $new_status The status the post is changing to.
    Required: Yes
  • (string) $old_status The status the post is changing from.
    Required: Yes
  • (WP_Post) $post Post object.
    Required: Yes
Defined at:
Codex:

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



Source

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