Automattic\WooCommerce\Admin\Notes

Notes::delete_all_notes()public staticWC 1.0

Soft delete of all the admin notes. Returns the deleted items.

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

Хуков нет.

Возвращает

Массив. Array of notes.

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

$result = Notes::delete_all_notes( $args );
$args(массив)
Arguments to pass to the query (ex: status).
По умолчанию: array()

Код Notes::delete_all_notes() WC 6.4.1

public static function delete_all_notes( $args = array() ) {
	$data_store = self::load_data_store();
	$defaults   = array(
		'order'      => 'desc',
		'orderby'    => 'date_created',
		'per_page'   => 25,
		'page'       => 1,
		'type'       => array(
			Note::E_WC_ADMIN_NOTE_INFORMATIONAL,
			Note::E_WC_ADMIN_NOTE_MARKETING,
			Note::E_WC_ADMIN_NOTE_WARNING,
			Note::E_WC_ADMIN_NOTE_SURVEY,
		),
		'is_deleted' => 0,
	);
	$args       = wp_parse_args( $args, $defaults );
	// Here we filter for the same params we are using to show the note list in client side.
	$raw_notes = $data_store->get_notes( $args );

	$notes = array();
	foreach ( (array) $raw_notes as $raw_note ) {
		$note = self::get_note( $raw_note->note_id );
		if ( $note ) {
			self::delete_note( $note );
			array_push( $notes, $note );
		}
	}
	return $notes;
}