Admin Conflict Logger
WordPress plugin that logs JavaScript errors with plugin context to help identify admin conflicts
by Mor · github.com/mortogo321/wordpress-admin-conflict-logger · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mortogo321/wordpress-admin-conflict-logger/archive/refs/heads/main.zipA WordPress plugin that demonstrates hook-based plugin architecture, secure AJAX handling, and lightweight client-side instrumentation — it captures JavaScript errors in wp-admin and on the frontend and identifies which active plugin (or theme) is the likely source.
What's Inside
- Singleton plugin class wiring into WordPress
init,admin_menu,admin_enqueue_scripts,wp_enqueue_scripts, andwp_ajax_*hooks - Global
error/unhandledrejectionlistener (assets/js/error-logger.js) with a debounced send queue, in-flight deduplication, and a filter list for non-actionable noise (e.g.ResizeObserver loop,ChunkLoadError) - AJAX endpoints for logging, clearing, and deleting entries, each protected with
check_ajax_referernonce checks andcurrent_user_can('manage_options')capability checks - Heuristic "suspected plugin" detection that matches the error's source/stack trace against active plugin folder names and the active theme's stylesheet
- Admin dashboard (
includes/admin-page.php) showing total error count, a per-plugin breakdown, a sortable log table, and a stack-trace modal - Storage via a single WordPress option (capped at the most recent 100 entries) — no external services, no schema changes
Tech Stack
- PHP 7.4+ targeting the WordPress Plugin API (WordPress 5.8+)
- Vanilla JavaScript for error capture; jQuery (bundled with WordPress core) for the admin UI
- WordPress Options API for persistence
- No build step or package manager — plain PHP/JS/CSS enqueued via
wp_enqueue_script/wp_enqueue_style
Quickstart
- Copy this folder into
wp-content/plugins/admin-conflict-loggeron a local WordPress install - Activate Admin Conflict Logger from the Plugins screen
- Open Conflict Logger in the wp-admin menu — JavaScript errors are captured automatically from that point on, in wp-admin for all users and on the frontend for logged-in administrators
Structure
admin-conflict-logger.php— plugin bootstrap: hooks, AJAX handlers, plugin/theme detection logicincludes/admin-page.php— dashboard templateassets/js/error-logger.js— error/rejection listener with debounce and dedupassets/js/admin.js— dashboard interactions (refresh, clear, delete, stack-trace modal)assets/css/admin.css— dashboard styling
License
GPL-2.0-or-later