block_core_calendar_update_has_published_post_on_transition_post_status()
Handler for updating the has published posts flag when a post status changes.
No Hooks.
Returns
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.
Changelog
| Since 5.9.0 | Introduced. |
block_core_calendar_update_has_published_post_on_transition_post_status() block core calendar update has published post on transition post status code WP 6.9.1
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();
}