WordPress · infra · fg-0103

'wp.data is undefined' JavaScript error on pages using WP Rocket delay JS

Uncaught TypeError from the inline wp-data-js-after script calling wp.data.use

Verified 2026-08-17 · Confirmed by 0 builders · Trust 50/100

Cause

Delay and defer reorder a core inline script so it runs before the script it depends on.

Fix

Dequeue the inline after-script on the front end if nothing there needs it, or exclude the dependency from delay.

Apply

$strip = function () { wp_scripts()->add_data('wp-data', 'after', []); }; add_action('wp_enqueue_scripts', $strip, 9999); add_action('wp_print_footer_scripts', $strip, 1); then confirm document.getElementById('wp-data-js-after') is null

Affects: WP Rocket delay JS, August 2026

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp