最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught ReferenceError: wp is not defined in wordpress - Stack Overflow

programmeradmin2浏览0评论

i have edit or add new page on wordpress ken theme with WPBakery Visual Composer but it not load properly

its give error on console

Uncaught ReferenceError: wp is not defined at mk_upload_option (admin-scripts.js:2)

image for better understand

i also done step like

  1. clear cache
  2. Deactive Active plugin
  3. delete wpbakery visual poser and install new with same version

but it did not work

i have edit or add new page on wordpress ken theme with WPBakery Visual Composer but it not load properly

its give error on console

Uncaught ReferenceError: wp is not defined at mk_upload_option (admin-scripts.js:2)

image for better understand

i also done step like

  1. clear cache
  2. Deactive Active plugin
  3. delete wpbakery visual poser and install new with same version

but it did not work

Share Improve this question asked Nov 16, 2017 at 11:28 Bhargav ChudasamaBhargav Chudasama 7,1715 gold badges23 silver badges41 bronze badges 11
  • Did you have this error with the Visual Composer being deactivated? – Blackbam Commented Nov 16, 2017 at 16:47
  • yes all plugin and poser plugin deactive but error also e how to resolve i try my best but any result so plss any one tell me how to resolve this problem @Blackbam – Bhargav Chudasama Commented Nov 17, 2017 at 4:39
  • If you deactivte the Theme for a minute, is the error still ocurring then? Because it might be some problem with the Themes' code. – Blackbam Commented Nov 17, 2017 at 12:38
  • so what i need to change – Bhargav Chudasama Commented Nov 17, 2017 at 12:39
  • Does the error still occur if you activate a different theme? – Blackbam Commented Nov 17, 2017 at 12:39
 |  Show 6 more ments

3 Answers 3

Reset to default 1

Try this, it may help.

Use customizer's js file array dependency as customize-preview while enqueuing.

wp_enqueue_script( 'customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '1.0', true );

This could be the result of plugin conflicts, such as Autoptimize or Async Javascript.

I would first try to put the following in the "exclude" section of Autoptimize, and the issue might well go away.

wp-includes/js

If the issue persists, I would exclude the following in both plugins:

wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, js/jquery/jquery.min.js

In my case, the problem was due to plugin conflicts. I used Elementor and
ThemeREX Addons.

I discovered the problem by deactivating the plugins one by one and checking in the Chrome Console when the errors disappeared.
The two of the above plugins have conflicts for loading jQuery.

So I decided to Deactivate the ThemeREX Addons and that worked for me.

Note that!!! If your plugin has exclude options it is better to use it and exclude already included scripts (from other plugins) because deactivating some of the plugins isn't the best decision in every case.

Another action that works is to edit the header.php file and add a link to the jQuery file at the top of the <head></head> section. But that edit will be overridden when a new update of the theme is created and you decide to update your theme and you will need to edit the file again. Note that if you forget to edit it again some important functions on your website could stop working. So DON'T EDIT THIS FILE.

Cheers.

发布评论

评论列表(0)

  1. 暂无评论