• Resolved Jonas

    (@gnuworld)


    Hi, so I have a page and in the editor I’ve deselected “Show sharing buttons” and updated the page. Afterwards when I look at the GTMetrix waterfall chart for the page I see that AddToAny is still loading

    addtoany.min.css
    addtoany.min.js

    and is calling for page.js from static.addtoany.com

    Why is the plugin still adding that bloat on a page where AddToAny is not being used?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author micropat

    (@micropat)

    AddToAny supports dynamic loading, e.g. image sharing, content loaded via Ajax, and similar publisher/developer use cases, so the required assets remain available by default.

    Developers can conditionally disable the core AddToAny script, and dequeue the plugin’s CSS & JS, for example:

    add_action( 'wp_enqueue_scripts', function() {
        // Your conditional goes here. For example:
        // Allow only on single posts (of any post type)
        if ( is_singular() ) return;
    
        // Remove AddToAny core script.
        // Note: This disables AddToAny's ability to load dynamically.
        add_filter( 'addtoany_script_disabled', '__return_true' );
    
        // Remove AddToAny plugin's JS & CSS.
        wp_dequeue_script( 'addtoany' );
        wp_dequeue_style( 'addtoany' );
    }, 21);
    Thread Starter Jonas

    (@gnuworld)

    Hi @micropat – thanks for getting back to me. It would be nice to have an option to disable it that doesn’t require a developer.

    To me it would make sense that unticking the “show sharing buttons” checkbox for a page would also stop AddToAny’s assets from being loaded on that page. With Google’s continued push to have site owners improve their page speeds, reducing unnecessary bloat is increasingly becoming more important.

    I’ve found I can get around this now with the help of the premium version of the Asset CleanUp plugin, but not everyone will want to pay to have access to something like that.

    Anyhow, just a recommendation.

    Good job on AddToAny as a whole, it’s a very nice plugin and generally does strike a fairly good balance between functionality and performance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘AddToAny adding bloat when disabled’ is closed to new replies.