• Resolved Roast Coffee

    (@roastercoffees)


    I only want AddToAny work on single posts. But when I deselect “Show sharing buttons” and updated the homepage, I see that AddToAny is still calling for page.js from static.addtoany.com.
    So how can I let it only working on single posts?

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.

    You can conditionally disable the core AddToAny script, and dequeue the plugin’s CSS & JS by adding the following PHP code using a “functionality” plugin such as the Code Snippets plugin:

    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 Roast Coffee

    (@roastercoffees)

    Great! It is effective! I solved it. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can i disable page.js from static.addtoany.com?’ is closed to new replies.