localStorage and sessionStorage are part of the Web Storage API, allowing websites to store key-value data in the visitor's browser. Unlike cookies, this data is not sent to the server with every request.
localStorage vs sessionStorage
- localStorage — Data persists until explicitly deleted. It survives browser restarts and has no expiration date. Typical limit: 5-10 MB per origin.
- sessionStorage — Data is cleared when the browser tab is closed. Each tab has its own sessionStorage. Same size limit.
Common Uses in WordPress
- Storing user preferences (dark mode, sidebar state)
- Caching API responses for faster page loads
- Shopping cart data in WooCommerce
- Form draft saving (auto-save before submission)
- Analytics and tracking data
Privacy Considerations
While localStorage data isn't sent to the server automatically like cookies, it can still be used for tracking purposes. Some GDPR interpretations require consent for non-essential localStorage usage, especially when used for analytics or advertising.
What InspectWP Checks
InspectWP lists all localStorage and sessionStorage entries set by your WordPress site. This helps you understand what data your site stores client-side and identify potential privacy concerns.