update_posts_count( string $deprecated = '' )

Update a blog’s post count.


Description Description

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.


Parameters Parameters

$deprecated

(string) (Optional) Not used.

Default value: ''


Top ↑

Source Source

File: wp-includes/ms-functions.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'" ) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
MU Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.