Documentation

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:

PlacementStorage key
Classic widget{widget_id}-textarea
Shortcodevalue of the id attribute (auto-generated if omitted)
Blockwpnotepad-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" }
  • time is epoch milliseconds, used for note expiry (TTL) and for conflict resolution in cross-device sync (last-write-wins).
  • When the textarea has a data-ttl value (days), notes whose now - time exceeds it are removed on load.

Filters

FilterDescription
wpnotepad_widget_textareaReceives the widget’s whole notepad markup (tab bar, textarea, toolbar, status) for customization
wpnotepad_widget_descriptionFilters 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.

EndpointMethodDescription
/wp-json/wp-notepad/v1/notesGETGet all notes of the logged-in user
/wp-json/wp-notepad/v1/notesPOSTSave a note (key / value required, time optional)
/wp-json/wp-notepad/v1/notes/{key}DELETEDelete the note with the given key
  • Server-side notes are stored in the rwc_wpnotepad_notes user meta.
  • The front end reads window.wpNotepad (which includes restUrl / nonce only while sync is enabled) and syncs with last-write-wins timestamp comparison.

Options

OptionValueDescription
rwc_wpnotepad_sync_enabled1 / 0Enables/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.

Source code

Copied title and URL