WordPress自定义不起作用-load-scripts.php错误

时间:2018-11-19 16:56:10

标签: php wordpress wordpress-theming customization

当我尝试自定义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 个答案:

答案 0 :(得分:1)

似乎您不是第一个遇到此问题的人。我无法为您调试问题(因为load-scripts.php是一个核心文件,负载很大),但是 MAYBE 您的问题与此处描述的相同:https://iansvoboda.com/code/dealing-load-scripts-php-console-errors-wordpress/

  

最终,问题归结为 functions.php include 顶部的多余空格。

     

如果您的WordPress主题的functions.php文件(或任何文件)   包含/必需)在第一个之前有额外的空格   打开PHP标签,WordPress可能无法正常运行。最正确   由空白引起的问题取决于您的设置和   在这种情况下,它们采取了控制台错误的形式。

因此:继续-检查您的主题文件。