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
$deprecatedstringoptional
Not used.Default: ''
Uses · 1
update_option()Updates the value of an option that was already added.
2092functionupdate_posts_count($deprecated=''){2093global$wpdb;2094update_option('post_count',(int)$wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'"),true);2095}
History
Introduced in MU (3.0.0). Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/ms-functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.