Few issues here.
-
use
add_filter()
instead ofapply_filters()
, to register your custom callback. -
return the value within your filter’s callback.
-
use the
get_comments_number
filter instead of thecomments_number
filter, since you only want to change the number and not the whole output of thecomments_number()
function. -
prefix the name of your custom callbacks, to avoid possible name collisions.
So try this version instead:
function wpse_comments_evolved_number( $count )
{
// Override the comment count
if( function_exists( 'comments_evolved_get_total_count' ) )
$count = comments_evolved_get_total_count();
// We must then return the value:
return $count;
}
add_filter( 'get_comments_number', 'wpse_comments_evolved_number');
where we make sure the function comments_evolved_get_total_count()
exists. We don’t want to bring down the whole site, if that plugin is uninstalled.
Hope it works.