Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Warning PHP statistics forums

@itsmifred

Participant

Hi Robin,

thank you so much for your work, here is where I am :

. no more warning Forums
. but count was double ; Tell 20 when there is 10 forums…

I checked and it was because I had a previous snippet ; when I disable that one, your code seems to be well working. Here is the previous one (made because without it only public forums were counted). Can you confirm please I can delete it and keep only yours ?

`function bbpress_include_private_posts_count($statistics, $r, $args){
if( isset($statistics[‘forum_count’]) ){
$private = wp_count_posts(“forum”)->private;
if( !empty($private) ){
$statistics[‘forum_count’] = $private + $statistics[‘forum_count’];
}
}
return $statistics;
}
add_filter(‘bbp_get_statistics’, ‘bbpress_include_private_posts_count’, 999, 3);

Skip to toolbar