Uses
| Uses | Description |
|---|---|
| wp-includes/post.php: get_post_type() | Retrieves the post type of the current post or of a given post. |
| wp-includes/ms-functions.php: update_posts_count() | Update a blog’s post count. |
Handler for updating the current site’s posts count when a post status changes.
(string) (Required) The status the post is changing to.
(string) (Required) The status the post is changing from.
(WP_Post) (Optional) Post object
Default value: null
File: wp-includes/ms-blogs.php
function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) {
if ( $new_status === $old_status ) {
return;
}
if ( 'post' !== get_post_type( $post ) ) {
return;
}
if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
return;
}
update_posts_count();
} | Version | Description |
|---|---|
| 4.9.0 | Added the $post parameter. |
| 4.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_update_posts_count_on_transition_post_status