Developer reference for WP Notepad: storage format, hooks, REST API and options.
Storage location and keys
Notes are stored in the visitor’s browser localStorage. The key depends on how the notepad is placed:
| Placement | Storage key |
|---|---|
| Classic widget | {widget_id}-textarea |
| Shortcode | value of the id attribute (auto-generated if omitted) |
| Block | wpnotepad-block-{notepadKey} |
| Tabs (second and later) | {baseKey}-tab-{N} |
Storage format
Since 2.0.0 notes are stored as a small timestamped JSON envelope. Plain strings saved by older versions are read transparently.
{ "v": 1, "time": 1750000000000, "value": "note text" }
timeis epoch milliseconds, used for note expiry (TTL) and for conflict resolution in cross-device sync (last-write-wins).- When the textarea has a
data-ttlvalue (days), notes whosenow - timeexceeds it are removed on load.
Filters
| Filter | Description |
|---|---|
wpnotepad_widget_textarea | Receives the widget’s whole notepad markup (tab bar, textarea, toolbar, status) for customization |
wpnotepad_widget_description | Filters the widget’s description output |
/**
* Example: wrap the widget's notepad markup.
*
* @param string $markup The whole notepad markup.
*/
add_filter( 'wpnotepad_widget_textarea', function ( $markup ) {
return '<div class="my-notepad-wrap">' . $markup . '</div>';
} );
REST API (cross-device sync)
Opt-in cross-device sync uses a REST API under the wp-notepad/v1 namespace. Routes are available only when sync is enabled and the user is logged in (cookie auth plus the X-WP-Nonce header); otherwise they return 401 / 403.
| Endpoint | Method | Description |
|---|---|---|
/wp-json/wp-notepad/v1/notes | GET | Get all notes of the logged-in user |
/wp-json/wp-notepad/v1/notes | POST | Save a note (key / value required, time optional) |
/wp-json/wp-notepad/v1/notes/{key} | DELETE | Delete the note with the given key |
- Server-side notes are stored in the
rwc_wpnotepad_notesuser meta. - The front end reads
window.wpNotepad(which includesrestUrl/nonceonly while sync is enabled) and syncs with last-write-wins timestamp comparison.
Options
| Option | Value | Description |
|---|---|---|
rwc_wpnotepad_sync_enabled | 1 / 0 | Enables/disables cross-device sync (default: disabled). Toggled under Settings → WP Notepad |
Uninstall
Visitors’ notes live in their browsers (LocalStorage), so deleting the plugin does not remove them. Server-side data (the rwc_wpnotepad_sync_enabled option and, if sync was used, the rwc_wpnotepad_notes user meta) is not deleted by the current version — remove it manually if you need a full cleanup.