woocommerce/plugins/woocommerce-beta-tester/api/admin-notes/delete-all-notes.php

25 lines
558 B
PHP
Raw Normal View History

2021-03-01 03:57:53 +00:00
<?php
2023-08-09 00:20:34 +00:00
defined( 'ABSPATH' ) || exit;
2021-03-03 06:27:47 +00:00
register_woocommerce_admin_test_helper_rest_route(
'/admin-notes/delete-all-notes/v1',
'admin_notes_delete_all_notes'
);
2021-03-01 03:57:53 +00:00
2023-08-09 00:20:34 +00:00
/**
* Deletes all admin notes.
*/
2021-03-01 03:57:53 +00:00
function admin_notes_delete_all_notes() {
global $wpdb;
2023-08-09 00:20:34 +00:00
2021-03-01 03:57:53 +00:00
$deleted_note_count = $wpdb->query( "DELETE FROM {$wpdb->prefix}wc_admin_notes" );
$deleted_action_count = $wpdb->query( "DELETE FROM {$wpdb->prefix}wc_admin_note_actions" );
return array(
'deleted_note_count' => $deleted_note_count,
'deleted_action_count' => $deleted_action_count,
);
}