WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

ActionScheduler_wpCommentLogger::get_comment_count() protected WC 1.0

Retrieve the comment counts from our cache, or the database if the cached version isn't set.

{} Это метод класса: ActionScheduler_wpCommentLogger{}

Хуков нет.

Возвращает

Объект. Ничего.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_comment_count();

Код ActionScheduler_wpCommentLogger::get_comment_count() WC 5.3.0

<?php
protected function get_comment_count() {
	global $wpdb;

	$stats = get_transient( 'as_comment_count' );

	if ( ! $stats ) {
		$stats = array();

		$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('order_note','action_log') GROUP BY comment_approved", ARRAY_A );

		$total = 0;
		$stats = array();
		$approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' );

		foreach ( (array) $count as $row ) {
			// Don't count post-trashed toward totals
			if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
				$total += $row['num_comments'];
			}
			if ( isset( $approved[ $row['comment_approved'] ] ) ) {
				$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
			}
		}

		$stats['total_comments'] = $total;
		$stats['all']            = $total;

		foreach ( $approved as $key ) {
			if ( empty( $stats[ $key ] ) ) {
				$stats[ $key ] = 0;
			}
		}

		$stats = (object) $stats;
		set_transient( 'as_comment_count', $stats );
	}

	return $stats;
}