Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp.utils.WordCounter is not a constructor #5118

Closed
mrleemon opened this issue Feb 17, 2018 · 4 comments
Closed

wp.utils.WordCounter is not a constructor #5118

mrleemon opened this issue Feb 17, 2018 · 4 comments
Labels
[Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.

Comments

@mrleemon
Copy link
Contributor

mrleemon commented Feb 17, 2018

Issue Overview

Since 2.2 I'm getting the following error when adding or editing a post:

Uncaught TypeError: wp.utils.WordCounter is not a constructor
    at load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,svg-painter,heartbeat,wp-auth-check,wp-ajax-response,suggest,jquery-color,wp-lists,jquery-ui-positi&load[]=on,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box,post,media-editor,media-audiovideo,mce-view,imgareaselect&load[]=,image-edit,jquery-ui-draggable,jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,quicktags,wplink,thickbox,media-upload,&load[]=sack,wp-pointer&ver=4.9.4:290
(anonymous) @ load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,svg-painter,heartbeat,wp-auth-check,wp-ajax-response,suggest,jquery-color,wp-lists,jquery-ui-positi&load[]=on,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box,post,media-editor,media-audiovideo,mce-view,imgareaselect&load[]=,image-edit,jquery-ui-draggable,jquery-ui-slider,jquery-touch-punch,iris,wp-color-picker,quicktags,wplink,thickbox,media-upload,&load[]=sack,wp-pointer&ver=4.9.4:290

Steps to Reproduce (for bugs)

  1. Add or edit a post
  2. Open browser console

Firefox and Chrome

Expected Behavior

Current Behavior

Possible Solution

Screenshots / Video

Related Issues and/or PRs

@Soean Soean added the [Type] Bug An existing feature does not function as intended label Feb 21, 2018
@Soean
Copy link
Member

Soean commented Feb 21, 2018

Do you have any other plugins active? If yes, can you test it without the other and activate them step by step?

Edit: I can reproduce this error with Polylang, if I add two languages and open the editor.

@Soean Soean added [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes. and removed [Type] Bug An existing feature does not function as intended labels Feb 21, 2018
@mrleemon
Copy link
Contributor Author

mrleemon commented Feb 21, 2018

Ok, I investigated the issue and it seems that the culprit is indeed the Polylang plugin:

https://wordpress.org/plugins/polylang/

@manooweb
Copy link
Contributor

manooweb commented Mar 15, 2018

The culprit is not exactly Polylang. wp.utils.WordCounter is a function of WordPress Core and I reproduce this case only when Gutenberg is activated, Polylang declare one language and when javascript files are concatenated. When I define the constante CONCATENATE_SCRIPTS to false, I have no js error.
I am looking for the cause of this issue.

I corrected this issue by loading our Polylang js script in the header. It is now avalaible in our master branch and will be available in our next release

@mrleemon
Copy link
Contributor Author

This is fixed in the latest version of Polylang (2.3.4):

polylang/polylang#225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Projects
None yet
Development

No branches or pull requests

3 participants