• Resolved Anonymous User 9948090

    (@anonymized-9948090)


    Hello guys

    First of all thanks for this great plugin. Its the most important and most popular plugin ever created fro WordPress.

    I wanted to ask about following issue:

    Recently I noticed that new versions of Akismet plugin add following 3 JS (Javascrpts) to posts which have comments section enabled:

    http://www.blogname.com/wp-includes/js/jquery/jquery.js?ver=1.11.0
    http://www.blogname.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1
    http://www.blogname.com/wp-content/plugins/akismet/_inc/form.js?ver=3.0.0

    These javascripts can be found in following code when you check the page source:

    <p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="" /></p><input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment_disabled" value="" /><script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>
    <script type='text/javascript' src='http://www.blogname.com/wp-includes/js/jquery/jquery.js?ver=1.11.0'></script>
    <script type='text/javascript' src='http://www.blogname.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
    <script type='text/javascript' src='http://www.blogname.com/wp-content/plugins/akismet/_inc/form.js?ver=3.0.0'></script>
    <p style="display: none;"><input type="hidden" id="ak_js" name="ak_js" value="146"/></p>

    These extra javascripts are increasing page loading time.

    Can you please tell me why these javascripts were added and can we disable them using any method?

    Thanks in advance.

    https://wordpress.org/plugins/akismet/

Viewing 11 replies - 1 through 11 (of 11 total)
  • I only just spotted this myself but it’s rather annoying given I already load JQuery in my theme – to have it twice is just unnecessary bloat.

    Thread Starter Anonymous User 9948090

    (@anonymized-9948090)

    ^^ Yeah.

    I’m surprised to see that neither the developer team nor any forum member has replied to this topic. Are those 3 javascripts necessary? Cant the developer team provide an option to disable some kind of feature which in return disable loading of these javascripts?

    given I already load JQuery in my theme

    Why? jQuery is loaded by default in WordPress core, so you should never re-load it. And, yes, all of those scripts are needed.

    Thread Starter Anonymous User 9948090

    (@anonymized-9948090)

    ^^ Thanks for your prompt reply. But those javascripts were not loaded in older versions of Akismet, so why suddenly they were used in the plugin?

    Cant we disable them by modifying any code or adding something somewhere?

    why suddenly they were used in the plugin

    Because the plugin has been updated. And jQuery is needed by WordPress core.

    Cant we disable them by modifying any code or adding something somewhere?

    No. If you try to do that, the plugin will stop working. Disable core jQuery and whole areas of WordPress will stop working.

    Thread Starter Anonymous User 9948090

    (@anonymized-9948090)

    ^^ Thanks but if the jQuery is needed by WordPress core, why does WordPress not call it automatically. Why Akismet plugin needs to call it separately?

    Why? Because I wrote my own theme from scratch and didn’t bother putting in WordPress’s standard code in the header and footer. Yes, this breaks some plugins but that’s fine because a) I generally prefer to bake stuff in directly rather than use plugins, and b) I can manually add in what I need. It keeps everything under control that way – especially plugins. I was amazed by how much unnecessary crap some plugins shove in your page.

    As such, I don’t bother with the version of Jquery included in WP core, and pull in the version hosted on Google’s servers instead. Which means I’m not re-loading it in my theme. Well except that I am because Askimet clearly knows what’s in my theme better than me.

    As for whether those scripts are needed? Well no, they are not. I just disabled Javascript and performed some tests, and could see no problems at all. Commenting just worked. I would guess it does something at some level, but it’s not essential.

    why does WordPress not call it automatically

    Try looking at the source for one of your admin pages, for example. You’ll find jQuery in there too. Or on any page that includes a comment form – irrespective of whether Akismet is running. jQuery is also used by many plugins and some themes.

    I wrote my own theme from scratch and didn’t bother putting in WordPress’s standard code in the header and footer.

    Then you cannot really complain. If you had followed WPORG theme coding standards, you wouldn’t have jQuery loading twice. The fault is in your theme – not in the plugin.

    Maybe if WordPress and its plugins were efficient in their code, then we wouldn’t have to ignore them. The fact is that out of the box, WordPress plugins, themes and templates are severely bloated. I want a fast, speedy, efficient website thanks.

    I would not be complaining incidentally if Akismet did what every other plugin does – fail. It’s the fact it’s doing the opposite that is the problem. If people want to have complete control, they should be able to do so. Plugins should not presume they know best.

    Esmi I think you’ve misunderstood the original question.

    The three files are loaded at the front end, what visitors are seeing not just under Admin where the files are needed by WordPress.

    I’m assuming the OP is using something like PageSpeed Insights to test pagespeed and finding those three js files are dragging down the results even though the first two shouldn’t be loaded by default at the front end. Just stumbled on this issue (was about to go to bed) so not looked into it yet, I do have another site running Akismet 3.0 that does not load the Akismet js file on the front end.

    Working on PageSpeed issues on a test site and on the front end Jquery shouldn’t be loading. Was in the process of testing a new responsive menu that doesn’t use jquery or the double menu ‘hack’ (a second dropdown menu) and jquery is still loading despite disabling it from the theme feature which was a WTF moment.

    Example page with Akismet js file as seen via Google’s PageSpeed Insights tool:
    http://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwordpress-test-3.xllx-inc.com%2Fmultiple-markup-tests%2F

    The WordPress install is running the WordPress MU Domain Mapping Plugin.

    The test site is a sub-domain install, looked at a domain mapped site (same install above, but the domain mapping plugin redirects it to another URL) and it’s loading the 3 js files on pages with comments active as well. So not loading the files on the home page.

    The other site I’ve checked is a standard WP install (not networked/domain mapped) and it’s fine.

    I guess the Akismet admin only script enqueuing is messing up for some sites and enqueing those 3 files at the front end. I know what I’m troubleshooting in the morning 🙂

    David

    Thread Starter Anonymous User 9948090

    (@anonymized-9948090)

    A big thanks to Akismet team. Today I found that a new version of Akismet was available to download and when I checked changelog, I found that the dev team has removed dependency upon those 2 extra javascripts. Now only a single javascript is loaded on every page. So the new updated version has reduced the total number of javascripts loaded by Akismet to only 1 from 3.

    Thanks for listening users requests. 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Akismet Adding 3 Extra Javascripts to Blog Post Pages’ is closed to new replies.