Automattic\WooCommerce\Admin\Notes

Notes::delete_notes_with_name()public staticWC 1.0

Deletes admin notes with a given name.

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

No Hooks.

Return

null. Nothing.

Usage

$result = Notes::delete_notes_with_name( $names );
$names(string|array) (required)
Name(s) to search for.

Code of Notes::delete_notes_with_name() WC 7.1.0

public static function delete_notes_with_name( $names ) {
	if ( is_string( $names ) ) {
		$names = array( $names );
	} elseif ( ! is_array( $names ) ) {
		return;
	}

	$data_store = self::load_data_store();

	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();
			}
		}
	}
}