update_posts_count
函数
update_posts_count ( $deprecated = '' )
- 参数
-
-
(string)
$deprecated
Not used.- Required: 否
- Default: (empty)
-
(string)
- 定义位置
-
-
wp-includes/ms-functions.php
, line 2011
-
wp-includes/ms-functions.php
- 引入
- –
- 弃用
- –
Updates 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.
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'" ) ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。