JS errors in admin
-
Hi,
Your plugin crashes in admin due to the ads you add in the utility.php
Just replace
jQuery.noConflict(true);
with
jQuery.noConflict();
Thanks
-
Can you provide more information and/or screenshots about these crashes?
The line(s) in question are both parts of Mailchimp embed codes, for what it’s worth.
Hi Michael,
Yes it’s linked to the mailchimp section.
Here is the beginning of the errors. they only appears on the CPT UI settings page :
Refused to load the script 'https://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com https://apis.google.com https://maps.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://cdnjs.cloudflare.com https://cdn.polyfill.io https://s7.addthis.com". hoverIntent.js?ver=1.8.1:33 Uncaught TypeError: Cannot read property 'fn' of undefined at hoverIntent.js?ver=1.8.1:33 at hoverIntent.js?ver=1.8.1:115 (anonymous) @ hoverIntent.js?ver=1.8.1:33 (anonymous) @ hoverIntent.js?ver=1.8.1:115 common.js:4 Uncaught TypeError: $ is not a function at common.js:4 at common.js:1152 (anonymous) @ common.js:4 (anonymous) @ common.js:1152 svg-painter.js:14 Uncaught TypeError: $ is not a function at svg-painter.js:14 at svg-painter.js:240 (anonymous) @ svg-painter.js:14 (anonymous) @ svg-painter.js:240 heartbeat.js:31 Uncaught TypeError: $ is not a function at new Heartbeat (heartbeat.js:31) at heartbeat.js:755 at heartbeat.js:757 Heartbeat @ heartbeat.js:31 (anonymous) @ heartbeat.js:755 (anonymous) @ heartbeat.js:757 wp-auth-check.js:96 Uncaught TypeError: $ is not a function at wp-auth-check.js:96 at wp-auth-check.js:117 (anonymous) @ wp-auth-check.js:96 (anonymous) @ wp-auth-check.js:117 media-models.js:306 Uncaught TypeError: $ is not a function at Object.20 (media-models.js:306) at __webpack_require__ (media-models.js:20) at 20.$ (media-models.js:63) at media-models.js:66 20 @ media-models.js:306 __webpack_require__ @ media-models.js:20 20.$ @ media-models.js:63 (anonymous) @ media-models.js:66 wp-plupload.js:321 Uncaught TypeError: Cannot read property 'extend' of undefined at wp-plupload.js:321 at wp-plupload.js:425 (anonymous) @ wp-plupload.js:321 (anonymous) @ wp-plupload.js:425 sortable.min.js?ver=1.11.4:11 Uncaught TypeError: Cannot read property 'widget' of undefined at sortable.min.js?ver=1.11.4:11 at sortable.min.js?ver=1.11.4:11 at sortable.min.js?ver=1.11.4:11 (anonymous) @ sortable.min.js?ver=1.11.4:11 (anonymous) @ sortable.min.js?ver=1.11.4:11 (anonymous) @ sortable.min.js?ver=1.11.4:11 wp-mediaelement.js:80 Uncaught TypeError: $ is not a function at wp-mediaelement.js:80 at wp-mediaelement.js:82 (anonymous) @ wp-mediaelement.js:80 (anonymous) @ wp-mediaelement.js:82 api-request.js:82 Uncaught TypeError: Cannot read property 'ajax' of undefined at api-request.js:82 at api-request.js:87 (anonymous) @ api-request.js:82 (anonymous) @ api-request.js:87 media-views.js:87 Uncaught TypeError: Cannot read property 'support' of undefined at Object.Array.concat.Region (media-views.js:87) at __webpack_require__ (media-views.js:20) at media-views.js:63 at media-views.js:66 Array.concat.Region @ media-views.js:87 __webpack_require__ @ media-views.js:20 (anonymous) @ media-views.js:63 (anonymous) @ media-views.js:66 media-editor.js:713 Uncaught TypeError: $ is not a function at media-editor.js:713 at media-editor.js:1058 (anonymous) @ media-editor.js:713 (anonymous) @ media-editor.js:1058 media-audiovideo.js:419 Uncaught TypeError: Cannot read property 'extend' of undefined at Object.State (media-audiovideo.js:419) at __webpack_require__ (media-audiovideo.js:20) at Object.Backbone.Model.extend.initialize (media-audiovideo.js:342) at __webpack_require__ (media-audiovideo.js:20) at media (media-audiovideo.js:63) at media-audiovideo.js:66
and it goes on and on…
Thanks, we’ll evaluate, test, see if we can recreate, and go from there. For the moment, feel free to edit the spots in question yourself.
Been mulling over this one a little bit. I was all ready to remove that
true
bit, but then I realized that part of the Mailchimp stuff that we load does have its own copy of jQuery included. So, it’s hard for me to justify because I’d prefer not breaking things more.That said, We do have the following 3 action hooks that you can remove that would prevent the mailing list parts from loading. at all. Worth trying out, for sure.
remove_action( 'cptui_main_page_before_changelog', 'cptui_about_page_newsletter' ); remove_action( 'cptui_below_post_type_tab_menu', 'cptui_products_sidebar' ); remove_action( 'cptui_below_taxonomy_tab_menu', 'cptui_products_sidebar' );
First item is a detail from the About page, the other two are the sidebars on the right side, when editing a post type or taxonomy. We don’t have a way to remove just part of itt, so we’ll just remove the whole sidebar.
Hi Micheal,
Thanks for the tip I’ll go for it for now. Let me know if you have some news.
Thanks again!
- The topic ‘JS errors in admin’ is closed to new replies.