_update_posts_count_on_transition_post_status()
Handler for updating the current site's posts count when a post status changes.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
_update_posts_count_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
По умолчанию: null
Список изменений
С версии 4.0.0 | Введена. |
С версии 4.9.0 | Added the $post parameter. |
Код _update_posts_count_on_transition_post_status() update posts count on transition post status WP 6.7.1
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(); }