Timber blocks access to edit posts/pages

1.2k Views Asked by At

I'm working on a Wordpress site I did not set up and it is using Timber with a modified Gesso theme. Whenever I go to edit a post or page it loads a blank screen. Nothing appears on the front end but here are the numerous errors from the console:

Uncaught SyntaxError: missing ) after argument list
post.php?post=157&action=edit:87 Uncaught ReferenceError: _ is not defined
    at post.php?post=157&action=edit:87
post.php?post=157&action=edit:151 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:151
    at post.php?post=157&action=edit:152
post.php?post=157&action=edit:157 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:157
    at post.php?post=157&action=edit:168
post.php?post=157&action=edit:188 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:188
    at post.php?post=157&action=edit:192
post.php?post=157&action=edit:201 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:201
    at post.php?post=157&action=edit:202
post.php?post=157&action=edit:206 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:206
post.php?post=157&action=edit:211 Uncaught ReferenceError: moment is not defined
    at post.php?post=157&action=edit:211
post.php?post=157&action=edit:217 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:217
    at post.php?post=157&action=edit:218
post.php?post=157&action=edit:226 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:226
    at post.php?post=157&action=edit:227
post.php?post=157&action=edit:239 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:239
    at post.php?post=157&action=edit:240
post.php?post=157&action=edit:245 Uncaught TypeError: Cannot read property 'editor' of undefined
    at post.php?post=157&action=edit:245
post.php?post=157&action=edit:249 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:249
post.php?post=157&action=edit:256 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:256
    at post.php?post=157&action=edit:257
post.php?post=157&action=edit:269 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:269
    at post.php?post=157&action=edit:270
post.php?post=157&action=edit:277 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:277
    at post.php?post=157&action=edit:278
post.php?post=157&action=edit:319 Uncaught ReferenceError: wp is not defined
    at post.php?post=157&action=edit:319
post.php?post=157&action=edit:2199 Uncaught ReferenceError: acf is not defined
    at post.php?post=157&action=edit:2199
post.php?post=157&action=edit:2203 Uncaught ReferenceError: acf is not defined
    at post.php?post=157&action=edit:2203
post.php?post=157&action=edit:2207 Uncaught ReferenceError: acf is not defined
    at post.php?post=157&action=edit:2207
    at post.php?post=157&action=edit:2212
load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,postbox,wp-dom-ready,wp-plugins&ver=5.2.4:7 Uncaught TypeError: Cannot read property 'createContext' of undefined
    at Module.377 (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,postbox,wp-dom-ready,wp-plugins&ver=5.2.4:7)
    at n (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,postbox,wp-dom-ready,wp-plugins&ver=5.2.4:7)
    at wp.plugins.0 (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,postbox,wp-dom-ready,wp-plugins&ver=5.2.4:7)
    at load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,postbox,wp-dom-ready,wp-plugins&ver=5.2.4:7
post.php?post=157&action=edit:2237 Uncaught TypeError: Cannot read property 'setLocaleData' of undefined
    at post.php?post=157&action=edit:2237
    at post.php?post=157&action=edit:2238
post.php?post=157&action=edit:2257 Uncaught TypeError: Cannot read property 'setLocaleData' of undefined
    at post.php?post=157&action=edit:2257
    at post.php?post=157&action=edit:2258
post.php:2681 Uncaught ReferenceError: tinymce is not defined
    at post.php:2681
data.min.js:1 Uncaught TypeError: Cannot read property 'flowRight' of undefined
    at Module.363 (data.min.js:1)
    at r (data.min.js:1)
    at wp.data.0 (data.min.js:1)
    at data.min.js:1
shortcode.min.js:1 Uncaught TypeError: Cannot read property 'extend' of undefined
    at Module.352 (shortcode.min.js:1)
    at n (shortcode.min.js:1)
    at wp.shortcode.2 (shortcode.min.js:1)
    at shortcode.min.js:1
blocks.min.js:2 Uncaught TypeError: Cannot read property 'combineReducers' of undefined
    at Module.362 (blocks.min.js:2)
    at r (blocks.min.js:1)
    at wp.blocks.0 (blocks.min.js:1)
    at blocks.min.js:1
keycodes.min.js:1 Uncaught TypeError: Cannot read property 'mapValues' of undefined
    at Module.382 (keycodes.min.js:1)
    at r (keycodes.min.js:1)
    at wp.keycodes.1 (keycodes.min.js:1)
    at keycodes.min.js:1
rich-text.min.js:1 Uncaught TypeError: Cannot read property 'combineReducers' of undefined
    at Module.361 (rich-text.min.js:1)
    at r (rich-text.min.js:1)
    at wp.richText.0 (rich-text.min.js:1)
    at rich-text.min.js:1
components.min.js:19 Uncaught TypeError: Cannot read property 'stubTrue' of undefined
    at e (components.min.js:19)
    at e (components.min.js:19)
    at compose.min.js:1
    at Module.<anonymous> (components.min.js:19)
    at n (components.min.js:1)
    at components.min.js:1
    at components.min.js:1
core-data.min.js:1 Uncaught TypeError: Cannot read property 'createRegistryControl' of undefined
    at Module.364 (core-data.min.js:1)
    at r (core-data.min.js:1)
    at wp.coreData.132 (core-data.min.js:1)
    at core-data.min.js:1
viewport.min.js:1 Uncaught TypeError: Cannot read property 'registerStore' of undefined
    at Module.372 (viewport.min.js:1)
    at n (viewport.min.js:1)
    at wp.viewport.2 (viewport.min.js:1)
    at viewport.min.js:1
block-editor.min.js:55 Uncaught TypeError: Cannot read property 'flow' of undefined
    at Module.357 (block-editor.min.js:55)
    at n (block-editor.min.js:1)
    at wp.blockEditor.0 (block-editor.min.js:1)
    at block-editor.min.js:1
notices.min.js:1 Uncaught TypeError: Cannot read property 'registerStore' of undefined
    at Module.371 (notices.min.js:1)
    at r (notices.min.js:1)
    at wp.notices.15 (notices.min.js:1)
    at notices.min.js:1
nux.min.js:1 Uncaught TypeError: Cannot read property 'combineReducers' of undefined
    at Module.375 (nux.min.js:1)
    at n (nux.min.js:1)
    at wp.nux.0 (nux.min.js:1)
    at nux.min.js:1
editor.min.js:17 Uncaught TypeError: Cannot read property 'SETTINGS_DEFAULTS' of undefined
    at Module.358 (editor.min.js:17)
    at n (editor.min.js:1)
    at wp.editor.0 (editor.min.js:1)
    at editor.min.js:1
block-library.min.js:23 Uncaught TypeError: Cannot read property 'withFallbackStyles' of undefined
    at Module.<anonymous> (block-library.min.js:23)
    at n (block-library.min.js:1)
    at Module.<anonymous> (block-library.min.js:25)
    at Module.<anonymous> (block-library.min.js:25)
    at n (block-library.min.js:1)
    at block-library.min.js:1
    at block-library.min.js:1
editor-block-3-15-1.js:1 Uncaught TypeError: Cannot read property 'Placeholder' of undefined
    at Module.<anonymous> (editor-block-3-15-1.js:1)
    at r (editor-block-3-15-1.js:1)
    at Object.<anonymous> (editor-block-3-15-1.js:1)
    at r (editor-block-3-15-1.js:1)
    at editor-block-3-15-1.js:1
    at editor-block-3-15-1.js:1
compose.min.js:1 Uncaught TypeError: Cannot read property 'flowRight' of undefined
    at Module.compose (compose.min.js:1)
    at Module.360 (edit-post.min.js:12)
    at n (edit-post.min.js:1)
    at wp.editPost.0 (edit-post.min.js:1)
    at edit-post.min.js:1
format-library.min.js:12 Uncaught TypeError: Cannot read property 'withSpokenMessages' of undefined
    at Module.367 (format-library.min.js:12)
    at n (format-library.min.js:1)
    at wp.formatLibrary.0 (format-library.min.js:1)
    at format-library.min.js:1
wp-seo-structured-data-blocks-1240.min.js:1 Uncaught TypeError: Cannot read property 'IconButton' of undefined
    at Object.868 (wp-seo-structured-data-blocks-1240.min.js:1)
    at f (commons-1240.min.js:1)
    at Object.849 (wp-seo-structured-data-blocks-1240.min.js:1)
    at f (commons-1240.min.js:1)
    at Object.848 (wp-seo-structured-data-blocks-1240.min.js:1)
    at f (commons-1240.min.js:1)
    at Object.847 (wp-seo-structured-data-blocks-1240.min.js:1)
    at f (commons-1240.min.js:1)
    at t (commons-1240.min.js:1)
    at Array.r [as push] (commons-1240.min.js:1)
annotations.min.js:1 Uncaught TypeError: Cannot read property 'registerStore' of undefined
    at Module.370 (annotations.min.js:1)
    at e (annotations.min.js:1)
    at wp.annotations.1 (annotations.min.js:1)
    at annotations.min.js:1
compose.min.js:1 Uncaught TypeError: Cannot read property 'flowRight' of undefined
    at Module.compose (compose.min.js:1)
    at Object.<anonymous> (wp-seo-post-scraper-1240.min.js:5)
    at f (commons-1240.min.js:1)
    at Object.<anonymous> (wp-seo-post-scraper-1240.min.js:5)
    at f (commons-1240.min.js:1)
    at Object.<anonymous> (wp-seo-post-scraper-1240.min.js:5)
    at f (commons-1240.min.js:1)
    at Object.<anonymous> (wp-seo-post-scraper-1240.min.js:5)
    at f (commons-1240.min.js:1)
    at Object.<anonymous> (wp-seo-post-scraper-1240.min.js:5)
post.php:2245 Uncaught TypeError: Cannot read property 'initializeEditor' of undefined
    at HTMLDocument.<anonymous> (post.php:2245)

If I deactivate the plugin I can access just fine, edit, and then all is normal again when I reactivate. The setup of this host is a little odd so I'm thinking it is a path issue but I can't quite figure out where that should be adjusted looking at the documentation and other folk's issues around the web.

Versions are:

WP 5.2.4

Timber 1.9.4 (that shows a warning not to upgrade. I can paste here if that's helpful but not sure if this is related. I tried updating to the new version and that did not help.)

Advanced Custom Fields PRO 5.8.6 (Might not be relevant but figured I would include in case)

Hosted on Pantheon

1

There are 1 best solutions below

1
Alley Hector On

Turns out it was a specific way of deferring javascript that was interfering. This is a pretty common function to add to wp but it interferes with Timber. For now I just turned it off but I'm sure if you just added relevant js files to bypass it would be fine but I will probably choose a more robust solution for deferring js going forward.

function defer_parsing_of_js ( $url ) {
  if ( FALSE === strpos( $url, '.js' ) ) return $url;
  if ( strpos( $url, 'jquery.js' ) ) return $url;
  return "$url' defer ";
  }
  add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );