Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




update_posts_count [ WordPress Function ]

update_posts_count ( $deprecated = '' )
Defined at:



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.

Source


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

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics