PluginProbe
Noted! / trunk
Noted! vtrunk
2.0.2 2.0.1 trunk 1.0 2.0
noted / developer-notes.txt

developer-notes.txt in Noted! trunk, at developer-notes.txt

38 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 # Noted! Plugin Developer Notes
2
3 This file contains code snippets and maintenance tasks intended for development and admin use only. Use these snippets with caution and remove them once tasks are completed to prevent unintended actions.
4
5 ---
6
7 ## Bulk Delete All Notes
8
9 This snippet will delete all notes created by the Noted! plugin. To execute this deletion, temporarily add the following function to your theme’s `functions.php` file.
10
11 ### Code Snippet
12
13 ```php
14 // Temporary function to delete all 'noted_note' posts.
15 function delete_all_noted_notes() {
16 if (is_admin() && current_user_can('administrator')) {
17 $noted_notes = get_posts(array(
18 'post_type' => 'noted_note',
19 'numberposts' => -1,
20 ));
21
22 foreach ($noted_notes as $note) {
23 wp_delete_post($note->ID, true); // Permanently delete
24 }
25
26 // Optional: Admin notice to confirm deletion.
27 add_action('admin_notices', function() {
28 echo '<div class="notice notice-success is-dismissible"><p>All Noted! notes have been deleted.</p></div>';
29 });
30 }
31 }
32 add_action('admin_init', 'delete_all_noted_notes');```
33
34 ### Instructions for Use
35 Paste the Code: Add the code above to your theme’s functions.php file.
36 Trigger Deletion: Load any admin page in your WordPress dashboard. This will execute the deletion of all noted_note posts.
37 Confirmation Message: After execution, a success message will display at the top of the admin page.
38 Remove the Code: After confirming the deletion, immediately remove the code from functions.php to avoid accidental future deletions.