Debugging Tables

When a [tablecrafter] table shows the wrong data, an error box, or nothing at all, the cause is almost always one of four things: a bad source response, stale cache, a PHP-side fetch error, or a JavaScript hydration failure. This page walks you through isolating each one.

WP_DEBUG Source response Cache purge Console errors Admin helper

How rendering works (so you know where to look)

TableCrafter renders in two passes, and knowing which pass failed narrows the search instantly:

i

The container is marked up with the attributes you passed to the shortcode (data-source, data-root, data-search, data-per-page, and so on). Inspecting that element in your browser confirms exactly what the server handed the JavaScript.

Step 1: Enable WP_DEBUG to capture server-side errors

TableCrafter's internal logger is silent unless WordPress debugging is on. Add the following to wp-config.php (above the /* That's all, stop editing! */ line):

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );   // writes to wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false ); // keep errors out of the page

With WP_DEBUG true, the plugin's logger writes entries to wp-content/debug.log. Look for these prefixes:

Log prefixSourceWhat it tells you
[TableCrafter]Main render / shortcode logicGeneral render and configuration problems.
[TableCrafter DataFetcher]Data fetcherProblems normalising or parsing the fetched payload.
TableCrafter HTTP ErrorHTTP request handlerTimeouts, non-200 responses, SSRF-blocked URLs.
TableCrafter Export ErrorExport handlerXLSX / PDF generation failures.
⚠️

The HTTP handler's informational log line (successful requests) only writes when both WP_DEBUG and WP_DEBUG_LOG are true. Error lines log whenever WP_DEBUG is on. If you see no HTTP entries at all, confirm both constants are set.

Step 2: Read the admin error helper

If the server fetch fails, logged-in administrators (capability manage_options) see a built-in TableCrafter Setup Guide box rendered in place of the table. It is the fastest diagnostic you have because it echoes the exact upstream error and the most common causes:

This helper is rendered with the class tc-admin-error-helper and is only visible to administrators. Non-admin visitors instead see a graceful tc-error-state message (or your custom text if you pass one). If you are logged out and only see "Unable to load data," log in as an admin and reload to read the real error.

Step 3: Check the source response directly

Most "broken table" reports trace back to the data source itself. Verify the raw response outside WordPress before touching plugin settings.

  1. Open the source URL in a browser or with curl. Confirm it returns 200 and valid JSON (or CSV for CSV sources):
    curl -i "https://api.example.com/v1/products"
  2. Confirm the shape is a list of rows. TableCrafter expects an array of objects. If your data is nested (for example under data.items), point the root attribute at it:
    [tablecrafter source="https://api.example.com/v1/products" root="data.items"]
  3. Inspect the rendered container. Right-click the table, choose Inspect, and read the <div class="tablecrafter-container">. Its data-source and data-root values must match what you intended. A <script class="tc-initial-data"> block inside the container holds the JSON the server actually parsed, which is the ground truth for what data made it through.
⚠️

TableCrafter proxies remote fetches through an SSRF guard. URLs that resolve to localhost or private IP ranges are blocked by design, so a source that works on your machine may be rejected on the server. Use a publicly reachable URL.

Step 4: Purge the cache after fixing the source

Because rendering is cached, fixing your data or a bad root path will not appear until the cache clears. TableCrafter stores transients keyed by a hash of the source plus its attributes:

Transient prefixHolds
tc_html_The rendered table HTML and parsed data (SWR cache).
tc_cache_Warmed raw responses for tracked URLs.
tc_export_Generated export files awaiting download.
tc_rate_Rate-limit counters for the fetch proxy.

The cleanest purge is the bundled WP-CLI command, which deletes every TableCrafter transient and reports the count:

# Remove all TableCrafter caches
wp tablecrafter clear-cache

# Re-fetch and re-cache all tracked source URLs
wp tablecrafter warm-cache

Without CLI access, the SWR layer self-heals: a cached entry older than five minutes schedules an invisible background refresh on the next page view, and entries expire after an hour. If you also run a page cache (NitroPack, WP Rocket, Cloudflare, and similar), purge that too, since it can serve the old HTML even after the transient is gone.

💡

The cache key includes search, filters, export, per_page, sort, and the plugin version, so changing any attribute already produces a fresh entry. You only need a manual purge when the upstream data changed but the shortcode did not.

Step 5: Debug the JavaScript pass with console output

If the table renders but search, sorting, filtering, or export do not work, the failure is in client-side hydration. The bundled library keeps verbose logging off by default. Turn it on in either of two ways:

With debug enabled, the library prints log and warn messages prefixed [TableCrafter] as it hydrates, parses embedded data, and walks the root path. Note that errors always print regardless of the flag, so a clean console with debug off still means no fatal JS error occurred. Watch for these signals:

Console messageLikely cause
Path segment "…" not found in dataThe root path does not match the response structure.
Hydration failed / Failed to parse embedded dataThe server-rendered tc-initial-data JSON is malformed or empty.
Load failed / Initial load failedThe client-side proxy fetch errored (network, nonce, or permissions).
Very large dataset (… rows) detectedPerformance warning; consider per_page pagination.
Auto-refresh failed / stopped after max retriesThe auto_refresh source is intermittently failing.

When a client fetch fails, the library replaces the table with a tc-error-container holding a tc-error-message and a tc-retry-button. Clicking Retry re-runs the load, which is useful for confirming whether a failure is transient.

Step 6: Verify the AJAX proxy and nonces

Client-side fetches and exports route through WordPress AJAX, not directly to your source. If the console shows fetch or permission errors, check these in the browser Network tab:

Quick reference: symptom to fix

SymptomFirst thing to check
Yellow "Please configure a data source" boxThe source attribute is empty or invalid (renders the tc-placeholder/tc-error notice).
Dashed red "TableCrafter Setup Guide" boxServer fetch failed; read the echoed error and verify source + root.
Table shows but won't sort/search/exportJS hydration; enable TABLECRAFTER_DEBUG and read the console.
Old data after you fixed the sourceRun wp tablecrafter clear-cache and purge your page cache.
Permanent tc-loading spinnerJS never initialized; check for a script error or that the library enqueued.

Disable debugging when you're done

Server logs can leak source URLs and request details into debug.log, and TABLECRAFTER_DEBUG adds console noise. After diagnosing, set WP_DEBUG back to false, remove window.TABLECRAFTER_DEBUG = true and any data-debug="true" attributes, and run one final wp tablecrafter clear-cache so production serves a clean, fresh render.

Next, see shortcode-reference.html for the full list of attributes referenced above, and caching.html for how the Stale-While-Revalidate layer and cache keys behave in production.