DataStore::get_notes_count()publicWC 1.0

Return a count of notes.

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

Хуков нет.


Массив. An array of objects containing a note id.


$DataStore = new DataStore();
$DataStore->get_notes_count( $type, $status, $context );
Comma separated list of note types.
По умолчанию: array()
Comma separated list of statuses.
По умолчанию: array()
Optional argument that the woocommerce_note_where_clauses filter can use to determine whether to apply extra conditions. Extensions should define their own contexts and use them to avoid adding to notes where clauses when not needed.
По умолчанию: self::WC_ADMIN_NOTE_OPER_GLOBAL

Код DataStore::get_notes_count() WC 6.6.1

public function get_notes_count( $type = array(), $status = array(), $context = self::WC_ADMIN_NOTE_OPER_GLOBAL ) {
	global $wpdb;

	$where_clauses = $this->get_notes_where_clauses(
			'type'   => $type,
			'status' => $status,

	if ( ! empty( $where_clauses ) ) {
		// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
		return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_admin_notes WHERE 1=1{$where_clauses}" );

	return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_admin_notes" );