1

我在一个我没有设置的 Wordpress 网站上工作,它使用的是带有修改过的 Gesso 主题的 Timber。每当我去编辑帖子或页面时,它都会加载一个空白屏幕。前端没有出现任何内容,但控制台出现了许多错误:

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)

如果我停用插件,我可以正常访问,编辑,然后当我重新激活时一切都正常了。这个主机的设置有点奇怪,所以我认为这是一个路径问题,但我不太清楚应该在哪里调整查看文档和网络上其他人的问题。

版本是:

WP 5.2.4

Timber 1.9.4(显示警告不要升级。如果有帮助,我可以在此处粘贴,但不确定这是否相关。我尝试更新到新版本,但没有帮助。)

Advanced Custom Fields PRO 5.8.6(可能不相关,但我想我会包括在内)

托管在万神殿

4

1 回答 1

0

事实证明,这是一种延迟干扰的 javascript 的特定方式。这是添加到 wp 的一个非常常见的功能,但它会干扰 Timber。现在我只是把它关掉了,但我确定如果你只是添加了相关的 js 文件来绕过它会很好,但我可能会选择一个更强大的解决方案来推迟 js。

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 );
于 2020-01-08T20:43:55.130 回答