JS Console error with Yoast SEO + Carbon Fields >=3.1.10
Version
- Carbon Fields: 3.1.10
- WordPress: Latest (5.3.2)
- PHP: 7.3
- Yoast SEO: Latest (12.8.1)
Behavior
The media library at http://asulabs.test/wp-admin/upload.php becomes unusable with Yoast SEO activated. The page loads with the following two JS errors:
Uncaught TypeError: _.pluck is not a function
https://dev-qesst-dotorg.pantheonsite.io/wp-admin/load-scripts.php?c=1&load%5Bchunk_0%5D=hoverIntent,common,hoverintent-js,admin-bar,underscore,shortcode,backbone,wp-util,wp-backbone,media-models,wp-plupload,jquery-ui&load%5Bchunk_1%5D=-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=5.3.2 line 10
and
Uncaught TypeError: Cannot read property 'hasClass' of undefined
https://dev-qesst-dotorg.pantheonsite.io/wp-includes/js/wp-auth-check.min.js?ver=5.3.2 line 1
Container definition
No specific container definition is needed to verify that the problem exists. This report was generated based on results from two separate themes for WordPress, both using Carbon Fields as a dependency. The container definitions are completely separate in both circumstances, but Carbon Fields is active and running in both instances.
Comments
This issue was submitted with the intent to verify a reproducible problem and also to verify that the latest release of the plugin (3.1.11) solves the issue.
So, I'm working with two separate themes that use this as a dependency. Updating the first theme via composer update to version 3.1.11 solved the first known case of this error.
Will also verify that the same solution solves the problem in the second circumstance.
Solution verified within the second theme, independently using Carbon Fields.
TL;DR: If your media library stops working for whatever reason, a composer update could be your best friend. :-)