Charts Not Rendering #
If the analytics pages load but charts appear as blank areas or show JavaScript errors in the browser console, use these steps.
Check the Browser Console #
- Press F12 to open developer tools
- Click the Console tab
- Navigate to an analytics page
- Look for red error messages
Common Console Errors #
“Chart is not defined” or “Chart.js not loaded” #
Cause: The Chart.js vendor library failed to load.
Fix:
1. Check if a JavaScript minification or optimization plugin is conflicting with Chart.js
2. Try deactivating optimization plugins (e.g., Autoptimize, WP Rocket scripts optimization) temporarily
3. Check your browser’s Network tab for a failed request to chart.umd.min.js
CORS Error on API Request #
Cause: The analytics page AJAX request to the REST API is being blocked by a CORS policy.
Fix:
1. Confirm your WordPress siteurl and home options match the URL you are accessing
2. Check if a security plugin is blocking REST API access
3. Go to Settings > Permalinks and click Save (this refreshes rewrite rules without changing anything)
“401 Unauthorized” in Network Tab #
Cause: The logged-in user does not have the manage_dmsilm_analytics capability.
Fix:
1. Confirm you are logged in as a WordPress Administrator
2. Check if a role management plugin has modified the Administrator role’s capabilities
