Automattic\WooCommerce\Admin\Notes
Notes::delete_notes_with_name() public WC 1.0
Deletes admin notes with a given name.
{} Это метод класса: Notes{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$result = Notes::delete_notes_with_name( $names );
- $names(строка/массив) (обязательный)
- Name(s) to search for.
Код Notes::delete_notes_with_name() Notes::delete notes with name WC 5.0.0
public static function delete_notes_with_name( $names ) {
if ( is_string( $names ) ) {
$names = array( $names );
} elseif ( ! is_array( $names ) ) {
return;
}
$data_store = \WC_Data_Store::load( 'admin-note' );
foreach ( $names as $name ) {
$note_ids = $data_store->get_notes_with_name( $name );
foreach ( (array) $note_ids as $note_id ) {
$note = self::get_note( $note_id );
if ( $note ) {
$note->delete();
}
}
}
}