Session Shredder for WooCommerce
Session Shredder is a production-grade, rule-based session cleanup plugin for WooCommerce 10.3+. WooCommerce 10.3 introduces experimental guest session storage and auto-pruning. Session Shredder builds directly on this already available foundation and adds behavior-based heuristics that predict which sessions are zombies (safe to prune) versus keepers (should be retained). Highlights – Heuristic pruning – Uses anonymized features (session age, pageviews, cart value, etc.) and conservative rules to identify low-value sessions. – Configurable rules & thresholds – Tune base age, hard timeout, bounce detection, and cart-protection rules from a dedicated WooCommerce settings screen. – Safe thresholds – Only considers sessions past a base age window and is biased towards keeping anything that shows meaningful activity or cart value. – Robust behavior – Even if tracking data is sparse, a conservative rule-based strategy kicks in (e.g. hard 72h timeout, bounces with no cart value). – Privacy-first – No PII is stored. Session IDs and countries are hashed; only coarse behavioral data is used. – Native Woo 10.3 integration – Reads from the WooCommerce session table (supports both legacy and new tables) and plays nicely with the core experimental pruning. – HPOS compatible – Declares compatibility with WooCommerce High-Performance Order Storage (custom order tables) and never touches orders, only session data. – Admin dashboard – Under WooCommerce → Session Shredder you get active sessions, pruned counts, a Chart.js visualization of active & pruned sessions per run, and a compact “Recent runs” summary. – Logging & observability – Uses wc_get_logger() for info/error logging; integrates cleanly with existing WooCommerce logs. Session Shredder is structured for real-world stores and designed as a companion to WooCommerce’s experimental guest session engine. It stays fully rule-based out of the box, but developers can extend it via hooks if they ever want to plug in external scoring services or AI endpoints. Why not rely only on the WooCommerce experimental pruning? – Core experimental pruning is largely age-based and opaque. – Session Shredder adds behavior-aware rules (pageviews, cart value, bounce flag) on top of age. – You get a dry-run mode to analyze impact before deleting anything. – The dashboard gives you visibility into how many sessions were pruned per run and how many sessions remained active. – WP-CLI commands let you script and automate analyze/prune runs. – It works alongside WooCommerce experimental guest sessions and HPOS rather than replacing them: Woo can still prune based on its own rules, while Session Shredder adds a tunable, rule-based layer with better reporting. How It Works Feature collection – On each page load, Session Shredder tracks session activity: – Session age (hours since first seen) – Pageviews count – Cart value (numeric) – Whether anything was added to cart – Geolocation hash (hashed billing/shipping country) – Simple bounce indicator (single pageview, no cart) – Features are stored per-session in non-autoloaded options and never include raw session IDs or user identifiers. Rule-based pruning – An hourly cron (session_shredder_cron) scans the WooCommerce session table for candidates based on age. – For each candidate, the plugin: – Loads stored features – Applies conservative rules like: – Session older than a hard timeout window (e.g. 72 hours) – Single pageview and no cart value – If the rules deem the session a low-value “zombie”, it is pruned. Stats & visualization – After each real run, Session Shredder records: – Total pruned sessions (lifetime and today) – A short history of recent runs, including how many sessions were pruned and how many remained active before/after each run – The admin dashboard renders a Chart.js line graph of active & pruned sessions per run via a secure AJAX endpoint, plus a compact “Recent runs” table. For developers Session Shredder exposes a small set of hooks and CLI commands so you can integrate it into more advanced workflows without forking the plugin. Hooks – session_shredder_features( array $features, string $session_hash ) – Filter the behavior feature array before it is stored and later used for pruning decisions. – $session_hash is a hashed identifier of the session (no raw IDs or PII). – session_shredder_base_age_hours( float $base_age_hours ) – Adjust the base age window (in hours) before sessions are considered as prune candidates. – session_shredder_should_prune( bool $should_prune, array $features ) – Override or refine the core rule-based decision for a given session. – session_shredder_feature_options_soft_limit( int $soft_limit ) – Adjust the soft cap for how many per-session feature options (session_shredder_features_*) are kept in wp_options before garbage collection trims the oldest entries. – session_shredder_feature_options_gc_batch( int $batch_size ) – Adjust how many feature options are removed per garbage-collection pass when the soft limit is exceeded. Larger values clean up faster; smaller values spread work over more runs. – session_shredder_before_run( float $base_age_hours, bool $dry_run ) – Fires before a prune run (cron, manual, or CLI) starts. – session_shredder_after_run( int $pruned_count, bool $dry_run ) – Fires after a prune run completes (dry-run or real). – session_shredder_pruned( int $pruned_count ) – Fires after a real prune run that actually deletes sessions; useful for logging or additional cleanup. WP-CLI commands If WP-CLI is available, Session Shredder registers the following commands: – wp session-shredder analyze – Performs a dry run using the current rules and settings. – Outputs the total number of sessions and how many would be pruned, without deleting anything. – wp session-shredder prune – Runs a real prune using the current rules and settings. – Deletes matching sessions, updates stats, and logs a summary.
Unused Media Checker
English Unused Media Checker helps you identify, inspect, and safely remove unused media files from your WordPress Media Library. The Media Library scan runs in small, resumable batches instead of one long request. This reduces the risk of gateway timeouts on sites with large media libraries. If the scan page is closed or reloaded, returning to the page resumes the saved scan progress. Version 1.4.0 has been tested on development and staging installations with Media Libraries containing more than 6,000 files. Actual scan time depends on the hosting environment, content volume and enabled integrations. The plugin analyzes your site and lists attachments that are not referenced in: Posts, pages, and all public custom post types (including featured images/thumbnails) Post content (Gutenberg blocks and classic content with wp-image-ID classes) Direct image URLs from the uploads folder (wp-content/uploads/...) Advanced Ads (media referenced via the advanced_ads_media meta) Theme Customizer (site logo, site icon, header image, background image – including retina variants) Rank Math FAQ blocks (images stored in FAQ block attributes) Photo Gallery (10Web): optional filename-based warning in the unused list (usage is not mapped via attachment IDs) Key features: Resumable AJAX batch scan with progress display for large Media Libraries Persistent scan snapshots for fast pagination and safer deletion checks Clear list of potentially unused attachments with thumbnails, title, date and quick “Inspect” link Accurate detection that respects logos, favicons, featured images and common SEO/ads integrations Bulk delete with nonce protection and clear success messages – no unexpected white screens Safe individual delete buttons per item with confirmation dialog Pagination and list rendering powered by WordPress’s native WP_List_Table class Optional Photo Gallery (10Web) helpers: Media Library warning when a file with the same name exists in Photo Gallery Photo Gallery files report (uploads/photo-gallery/) with grouping and an “unused motif” filter Fully translation-ready via the textdomain unused-media-checker Deutsch Unused Media Checker hilft Ihnen, ungenutzte Dateien in Ihrer WordPress‑Mediathek zu identifizieren, zu überprüfen und sicher zu entfernen. Der Mediathek-Scan läuft in kleinen, fortsetzbaren Arbeitsschritten statt in einer einzigen langen Anfrage. Dadurch sinkt bei großen Mediatheken das Risiko eines Gateway-Timeouts. Wird die Scan-Seite geschlossen oder neu geladen, setzt das Plugin den gespeicherten Fortschritt beim nächsten Aufruf fort. Version 1.4.0 wurde in Entwicklungs- und Staging-Installationen mit Mediatheken mit mehr als 6.000 Dateien getestet. Die tatsächliche Scandauer hängt vom Hosting, dem Inhaltsumfang und den aktivierten Integrationen ab. Das Plugin analysiert Ihre Website und listet Anhänge, die nicht referenziert werden in: Beiträgen, Seiten und allen öffentlichen Custom Post Types (inkl. Beitragsbilder/Thumbnails) Beitragsinhalten (Gutenberg‑Blöcke und klassischer Editor mit wp-image-ID‑Klassen) Direkt eingebundenen Bild‑URLs aus dem Uploads‑Ordner (wp-content/uploads/...) Advanced Ads (Medien im Meta‑Feld advanced_ads_media) Theme‑Customizer (Website‑Logo, Website‑Icon, Header‑Bild, Hintergrundbild – inkl. Retina‑Varianten) Rank‑Math‑FAQ‑Blöcken (Bilder in den FAQ‑Block‑Attributen) Photo Gallery (10Web): optionaler Dateinamen‑Hinweis in der Unused‑Liste (Nutzung wird nicht über Attachment‑IDs gemappt) Funktionen: Fortsetzbarer AJAX-Batch-Scan mit Fortschrittsanzeige für große Mediatheken Persistente Scan-Snapshots für schnelle Paginierung und sicherere Löschprüfungen Übersichtliche Liste potenziell ungenutzter Anhänge mit Vorschaubild, Titel, Datum und “Inspect”‑Link Präzise Erkennung, die Logos, Favicons, Beitragsbilder und gängige SEO/Ads‑Integrationen berücksichtigt Massenlöschung mit Nonce‑Schutz und klaren Erfolgsmeldungen – keine unerwarteten weißen Seiten Sicheres, einzelnes Löschen je Datei mit Bestätigungsdialog Massenaktionen und Paginierung basierend auf der WordPress‑Klasse WP_List_Table Optionale Photo Gallery (10Web) Hilfen: Warnhinweis in der Mediathek‑Unused‑Liste, wenn ein gleichnamiges File in Photo Gallery existiert Report für Photo Gallery Dateien (uploads/photo-gallery/) inkl. Gruppierung und Filter „Nur ungenutzte Motive“ Übersetzungsbereit über die Textdomain unused-media-checker (z. B. Deutsch, Englisch und weitere Sprachen) Privacy The plugin processes site content and media information locally in the WordPress installation. It does not send scan data to an external service. Scan progress and result snapshots are stored in the site’s WordPress database. Support For issues or questions, visit: https://derwebfuchs.de/wordpress-mediathek-aufraumen-unused-media-checker/