• Resolved StarryMom

    (@starrymom)


    Is there a filter or function so that Add to Any files (JS/CSS/etc) are only loaded on pages that have Add to Any enabled?

    For example. I do not have Add to Any loading on my homepage itself, only on single posts. So I don’t need the core.js loading on the homepage.

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

    (@micropat)

    Yep, you can use the addtoany_script_disabled filter to programmatically remove all AddToAny JS & CSS.

    Just note that this also disables AddToAny ability to load on dynamically inserted content such as with infinite scrolls, etc.

    Usage 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 CSS/JS scripts.
        // Note: This disables AddToAny's ability to load dynamically.
        add_filter( 'addtoany_script_disabled', '__return_true' );
    });

    Hi Team i have already installed Add to any on my website , when anyone post us jobs to our website , and anyone want to share those jobs to linkdin or other social media website it suddenly closed and sometime not generate the preview of the post , Please let me know How can i fix this , My website is USA STAFFING , Please help me to fix this , I required your help sir/mam ,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter to load plugin only on pages using Add to Any?’ is closed to new replies.