WC_REST_System_Status_V2_Controller::get_post_type_counts()publicWC 1.0

Get array of counts of objects. Orders, products, etc.

Метод класса: WC_REST_System_Status_V2_Controller{}

Хуков нет.

Возвращает

Массив.

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

$WC_REST_System_Status_V2_Controller = new WC_REST_System_Status_V2_Controller();
$WC_REST_System_Status_V2_Controller->get_post_type_counts();

Код WC_REST_System_Status_V2_Controller::get_post_type_counts() WC 8.7.0

public function get_post_type_counts() {
	global $wpdb;

	$post_type_counts = $wpdb->get_results( "SELECT post_type AS 'type', count(1) AS 'count' FROM {$wpdb->posts} GROUP BY post_type;" );

	return is_array( $post_type_counts ) ? $post_type_counts : array();
}