Font-awesome: FontAwesome CDN script with icon stats reporting enabled gives an error on using the Wordpress Media Uploader

Created on 21 Jun 2016  路  13Comments  路  Source: FortAwesome/Font-Awesome

I have just included the new FontAwesome script using the FontAwesome javascript cdn method.

Now I'm trying to use the Wordpress media upload feature when editing or creating a new page. When the Font Awesome script is loaded I get the error stated below. When I deactivate the script, the media uploader works fine.

Uncaught TypeError: this.activateMode is not a function

bug cdn

All 13 comments

Could you please provide more details?

Wordpress version? Step by step guide to reproduce issue? How the script is included in the wordpress backend?

Hi Tagliala, thanks for your reply. Sorry for the incomplete issue summary. I'm using Wordpress 4.5.2 on a local .dev development installation.

To reproduce the error, please install a new Wordpress installation (or try it on an existing one). Add the following code to your functions.php:

function custom_admin_scripts() { wp_enqueue_script( 'font_awesome', 'https://use.fontawesome.com/EDITED.js'); } add_action( 'admin_enqueue_scripts', 'custom_admin_scripts' );

After you've followed the previous steps, go to your Wordpress admin, add a new page/post and try to add an image using the "Add Media" button. The error console will log the error stated in my issue.

Add the following code to your functions.php:

which one? /wp-includes/functions.php or theme related files?

To your theme functions.php. I have included it inside a plugin but the result is the same.

It works for me.

WP: 4.5.3
Theme: twentysixteen
functions.php

function custom_admin_scripts() {
  wp_enqueue_script( 'font_awesome', 'https://use.fontawesome.com/EDITED.js' );
}
add_action( 'admin_enqueue_scripts', 'custom_admin_scripts' );

(Please note that wp_enqueue_script( 'font_awesome', 'https://use.fontawesome.com/EDITED.js', array(), null ); is better because otherwise WP adds ?ver=4.5.3 to the src attribute)

Result:
screen shot 2016-06-22 at 11 26 20

Could you please provide me your .js configuration at fontawesome cdn? This is mine.

screen shot 2016-06-22 at 11 29 30

schermafbeelding 2016-06-22 om 11 40 17

I've tried your options and found out that when I turn off "Icon stats reporting" everything works fine. So it works fine right now, people should turn off "Icon stats reporting" like below.

schermafbeelding 2016-06-22 om 11 40 40

Thanks for your help Tagliala, really appreciate it!

By the way, do you think you guys are going to release a fix for this? Or do you recommend to just use the fix mentioned above?

I can confirm this happens with the icon stats reporting enabled

@davegandy @robmadole @supercodepoet

@Syourt we'll get a fix for this. Let me carve out some time next week to look at this. Just to confirm, this isn't currently blocking you is it with the above workaround?

@tagliala thank you for running this down with the details!

Hi @robmadole, thanks for your effort. I'm fine with this workaround, it's a fun feature to see how many times certain icons are used, but absolutely not necessary for me. Good luck with the fix!

@Syourt we have a fix for this on the CDN project up in a PR. Should get merged and deployed tomorrow and then if you don't mind I'll ask you to give it a shot to see if we have it fixed for you. I'll let you know.

@Syourt this has been deployed. Can you give it a shot now? Just re-enable stats reporting for that embed code and then give it another try.

Hi @robmadole, it works! Now I don't get any errors anymore. This bug is solved, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

huuphat picture huuphat  路  3Comments

lickmydesign picture lickmydesign  路  3Comments

faithdong picture faithdong  路  3Comments

omnimint picture omnimint  路  3Comments

jakuuub picture jakuuub  路  3Comments