WC_Notes_Run_Db_Update::get_current_notice()
Get current notice id from the database.
Retrieves the first notice of this type.
Method of the class: WC_Notes_Run_Db_Update{}
No Hooks.
Return
Int|null
. Note id or null in case no note was found.
Usage
$result = WC_Notes_Run_Db_Update::get_current_notice();
WC_Notes_Run_Db_Update::get_current_notice() WC Notes Run Db Update::get current notice code WC 9.7.1
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 Note( $note_id ); $data_store->delete( $note ); } return $current_notice; } return current( $note_ids ); }