Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WC_Notes_Run_Db_Update::get_current_notice()

Get current notice id from the database.


Description Description

Retrieves the first notice of this type.


Return Return

(int|void) Note id or null in case no note was found.


Top ↑

Source Source

File: includes/admin/notes/class-wc-notes-run-db-update.php

	private static function get_current_notice() {
		try {
			$data_store = \WC_Data_Store::load( 'admin-note' );
		} catch ( Exception $e ) {
			return;
		}
		$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );

		if ( empty( $note_ids ) ) {
			return;
		}

		if ( count( $note_ids ) > 1 ) {
			// Remove weird duplicates. Leave the first one.
			$current_notice = array_shift( $note_ids );
			foreach ( $note_ids as $note_id ) {
				$note = new WC_Admin_Note( $note_id );
				$data_store->delete( $note );
			}
			return $current_notice;
		}

		return current( $note_ids );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.