WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Купить персональные IPV4 и IPV6 прокси
функция не описана

update_posts_count() WP 3.0.0

Update a blog's post count.

WordPress MS stores a blog's post count as an option so as to avoid extraneous COUNTs when a blog's details are fetched with get_site(). This function is called when posts are published or unpublished to make sure the count stays current.

Хуков нет.

Возвращает

Null. Ничего.

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

update_posts_count( $deprecated );
$deprecated(строка)
Not used.
По умолчанию: ''

Заметки

  • Global. wpdb. $wpdb WordPress database abstraction object.

Список изменений

С версии 3.0.0 Введена.

Код update posts count: wp-includes/ms-functions.php WP 5.2.2

<?php
function update_posts_count( $deprecated = '' ) {
	global $wpdb;
	update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
}