尝试自定义Wordpress主题时, 出现空白屏幕。我禁用了插件, 但错误仍然存在-这是主题, 我尝试了其他主题, 问题不再存在。
我运行了JS控制台并收到了这些错误, 但我不知道它们是什么意思:
load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:58 Uncaught TypeError: Cannot read property 'replace' of undefined
at Function.m.template (load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:58)
at n.template (load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:61)
at n.render (load-scripts.php?c=1&load[]=jquery-ui-slider, jquery-touch-punch, iris, wp-color-picker, heartbeat, customize-base, customize-controls, customize-widgets, thickbox, &load[]=mce-view, imgareaselect, image-edit, quicktags, wplink, jquery-ui-position, jquery-ui-menu, jquery-ui-autocomplete, media-upload, accordi&load[]=on, customize-nav-menus, customize-models, customize-views, updates&ver=4.9.8:722)
at n.initialize (load-scripts.php?c=1&load[]=jquery-ui-slider, jquery-touch-punch, iris, wp-color-picker, heartbeat, customize-base, customize-controls, customize-widgets, thickbox, &load[]=mce-view, imgareaselect, image-edit, quicktags, wplink, jquery-ui-position, jquery-ui-menu, jquery-ui-autocomplete, media-upload, accordi&load[]=on, customize-nav-menus, customize-models, customize-views, updates&ver=4.9.8:718)
at n.e.View (load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:84)
at n.constructor (load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:86)
at new n (load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:84)
at f.ready (load-scripts.php?c=1&load[]=jquery-ui-slider, jquery-touch-punch, iris, wp-color-picker, heartbeat, customize-base, customize-controls, customize-widgets, thickbox, &load[]=mce-view, imgareaselect, image-edit, quicktags, wplink, jquery-ui-position, jquery-ui-menu, jquery-ui-autocomplete, media-upload, accordi&load[]=on, customize-nav-menus, customize-models, customize-views, updates&ver=4.9.8:31)
at Object.<anonymous> (load-scripts.php?c=1&load[]=jquery-ui-slider, jquery-touch-punch, iris, wp-color-picker, heartbeat, customize-base, customize-controls, customize-widgets, thickbox, &load[]=mce-view, imgareaselect, image-edit, quicktags, wplink, jquery-ui-position, jquery-ui-menu, jquery-ui-autocomplete, media-upload, accordi&load[]=on, customize-nav-menus, customize-models, customize-views, updates&ver=4.9.8:31)
at i (load-scripts.php?c=1&load[]=jquery-core, jquery-migrate, jquery-ui-core, jquery-ui-widget, jquery-ui-mouse, jquery-ui-draggable, underscore, wp-a11y, wp-util, jquery&load[]=-ui-sortable, jquery-ui-droppable, backbone, wp-backbone, jquery-ui-tabs, shortcode, utils, media-models, moxiejs, plupload, wp-plupload&ver=4.9.8:2)
#1
看来你不是第一个遇到此问题的人。我无法为你调试问题(因为load-scripts.php是一个核心文件, 负载很大), 但也许你的问题与此处所述相同:https://iansvoboda.com/code/dealing-load-脚本php-console-errors-wordpress /
最终, 问题归结为functions.php include顶部的多余空格。如果你的WordPress主题的functions.php文件(或其中的所有文件/其中包含/需要的文件)在第一次打开PHP标记之前具有多余的空格, 则WordPress可能无法正常运行。由空格引起的确切问题因你的设置而异, 在这种情况下, 它们采取控制台错误的形式。
因此:继续-检查主题文件。
评论前必须登录!
注册