Automattic\WooCommerce\Admin\Notes
Notes::delete_all_notes() public WC 1.0
Soft delete of all the admin notes. Returns the deleted items.
{} Это метод класса: Notes{}
Хуков нет.
Возвращает
Массив. Array of notes.
Использование
$result = Notes::delete_all_notes();
Код Notes::delete_all_notes() Notes::delete all notes WC 5.0.0
public static function delete_all_notes() {
$data_store = \WC_Data_Store::load( 'admin-note' );
// Here we filter for the same params we are using to show the note list in client side.
$raw_notes = $data_store->get_notes(
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,
)
);
$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;
}