update_posts_count

Definition:
function update_posts_count( $deprecated = '' ) {}

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_blog_details(). This function is called when posts are published to make sure the count stays current.

Parameters

  • $deprecated

Source code

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'" ) );

3193

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: