Automattic\WooCommerce\Admin\Notes
DataStore::delete
Deletes a note from the database.
Method of the class: DataStore{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$DataStore = new DataStore(); $DataStore->delete( $note, $args );
- $note(Note) (required) (passed by reference — &)
- Admin note.
- $args(array)
- Array of args to pass to the delete method (not used).
Default:array()
DataStore::delete() DataStore::delete code WC 10.5.0
public function delete( &$note, $args = array() ) {
$note_id = $note->get_id();
if ( $note_id ) {
global $wpdb;
$wpdb->delete( $wpdb->prefix . 'wc_admin_notes', array( 'note_id' => $note_id ) );
$wpdb->delete( $wpdb->prefix . 'wc_admin_note_actions', array( 'note_id' => $note_id ) );
$note->set_id( null );
}
/**
* Fires when an admin note is deleted.
*
* @param int $note_id Note ID.
*/
do_action( 'woocommerce_note_deleted', $note_id );
}