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

JavaScript Error: wpColorPicker is not a function #118

Open
technotarek opened this issue Feb 2, 2016 · 7 comments
Open

JavaScript Error: wpColorPicker is not a function #118

technotarek opened this issue Feb 2, 2016 · 7 comments

Comments

@technotarek
Copy link

I'm getting this error when running the plugin and I think it is adversely affecting the WYSIWYG editor (e.g,. can't insert links; can't toggle to the 'text' tab etc).

WordPress Version: 4.4.1
Plugin Version: 2.1.0

Triggered by:

$('.at-color').wpColorPicker();

Happy to try to pitch in and help -- would be great if you could point me in the right direction though.

@technotarek
Copy link
Author

I confirmed that commenting out lines 63 and 157 of tax-meta-clss.js removes the errors (obviously) and that doing so also restores the other broken functionality that I had mentioned. Is there a known substitute for wpColorPicker? Is the only role it plays is to allow selecting a color in the WYSIWYG?

@Akamaozu
Copy link

Akamaozu commented May 3, 2016

@technotarek I got the same error and wrote a fix for the issue here: #122.

Do you mind testing it to see if it works for you?

@technotarek
Copy link
Author

@Akamaozu I ended up using an alternative approach and am no longer using this plugin.

@baysideufl
Copy link

First, excellent library. Thanks for the hard work!

I had this issue too. In my case I was using the color picker which worked when I was creating terms, but not when editing a term (ie: /wp-admin/edit-tags.php vs /wp-admin/term.php). Turns out the is_edit_page() check was only returning true for edit-tags.php and therefore the enqueues for the styles and scripts weren't getting fired. So in Tax-meta-class.php line 1133 I changed the function check from:

public function is_edit_page() { global $pagenow; return ( $pagenow == 'edit-tags.php' ); }

to:
public function is_edit_page() { global $pagenow; return ( $pagenow == 'edit-tags.php' || $pagenow == 'term.php' ); }

and all seems to be well.

I'll get this forked and do a pull request later, but thought this may help someone in the meantime.

@Mathiu
Copy link

Mathiu commented Jun 20, 2016

Another and in my opinion quickest fix would be to add wp-color-picker as a dependency for tax-meta-clss script at line 162.

@Akamaozu
Copy link

Akamaozu commented Jun 20, 2016

@Mathiu but that means loading wp-color-picker even when it's not going to be used.

If every other plugin behaved that way, you'd quickly end up with a bloated WordPress installation.

I wrote a solution (#122) that takes the other approach: doesn't blindly execute the color picker function if it doesn't need to.

It solved other people's problem: #117

Would appreciate it if you can check that it solves yours.

@hughbris
Copy link

hughbris commented Jun 8, 2018

@Mathiu thanks, solved it for me. I'm not using a colour picker. I suspect if I used one, this wouldn't help though. Won't be needing it, so that will remain conjecture.

If every other plugin behaved that way, you'd quickly end up with a bloated WordPress installation.

Wordpress? Bloat? Surely not!! LOL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants