• Resolved catmaniax

    (@catmaniax)


    Hello.

    I only use Social Commenting and I’d like to ask you if you can please make the plugin stop loading its JS & CSS files in unnecessary pages like the homepage, and only run inside posts, where it is needed.

    Here are all the files running in the homepage:

    /wp-content/plugins/super-socializer/js/front/social_login/general.js
    /wp-content/plugins/super-socializer/js/front/facebook/sdk.js
    /wp-content/plugins/super-socializer/css/front.css

    Please let me know.
    Thanks!

Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author Heateor Support

    (@heateor)

    Hi,

    We will improve this in upcoming releases.

    Thread Starter catmaniax

    (@catmaniax)

    Please let me know when you do.
    Is an update coming soon?

    Plugin Author Heateor Support

    (@heateor)

    We are not sure about the timeline. We will keep you posted.

    Thread Starter catmaniax

    (@catmaniax)

    Ok, thanks.

    Also requesting this feature. Since the plugin not only loads a bunch of own file but also querys external APIs this really slows down page load.

    I’ve manually hacked the hooks to unhook the plugin on pages where I don’t need it, but this should come out of the box.

    Plugin Author Heateor Support

    (@heateor)

    @kontur, sorry about that. We are keeping it for upcoming releases.

    Thread Starter catmaniax

    (@catmaniax)

    Any ETA?

    Plugin Author Heateor Support

    (@heateor)

    @catmaniax, Problem is, this might require to re-structure the plugin (or even releasing a new revamped version of the plugin along with other required improvement and migrating users from this to that). That’s why estimating timeline for this is a bit difficult.

    To me the requested feature doesn’t really imply restructuring the plugin. Just like I unhooked those script and stylesheet hooks, the plugin should be doing those checks itself based on what page gets loaded, and if that page has login / register / password reset functionality or any of the shortcodes on it.

    The beauty of WP’s enqueue functions is exactly that you can add your scripts when needed. The code that renders the plugin’s own shortcodes or the function that is called from it should be the places to enqueue the scripts. Right now the plugin just bluntly adds the overhead to all pages.

    Plugin Author Heateor Support

    (@heateor)

    @kontur, We understand that. Don’t worry, we will do it ASAP.

    Thread Starter catmaniax

    (@catmaniax)

    So, since quite some time has passed and this is pretty serious, is there a solution for this coming anytime soon?

    Agree. Not slowing down load performance ON ALL pages would be indeed something that should be priority. All this needs from the plugin authors is to move enqueues to the shortcode detection — not really that hard.

    I’m only using the social login, and this is my work around to remove loading this plugin’s scripts and styles on all pages; use or modify at your own risk:

    
    /**
     * Remove about 300kb by loading social login scripts and styles only
     * pages that have a login form
     */
    $account_pages = array("account", "checkout");
    
    function us_filter_scripts() {
        global $wp_scripts, $wp, $account_pages;
    
        wp_dequeue_script('wc-add-to-cart');
        wp_dequeue_script('wc-cart-fragments');
    
        if (empty($wp->query_vars['pagename']) || !in_array($wp->query_vars['pagename'], $account_pages)) {
            wp_dequeue_script('the_champ_combined_script');
            wp_dequeue_script('the_champ_ss_general_scripts');
            wp_dequeue_script('the_champ_sl_common');
            wp_dequeue_script('the_champ_sl_google');
            wp_dequeue_script('the_champ_fb_sdk');
            wp_dequeue_script('the_champ_sl_facebook');
        }
    }
    add_action( 'wp_print_scripts', 'us_filter_scripts' );
    
    function us_filter_styles() {
        global $wp_styles, $wp, $account_pages;
    
        if (empty($wp->query_vars['pagename']) || !in_array($wp->query_vars['pagename'], $account_pages)) {
            wp_dequeue_style('the_champ_frontend_css');
        }
    }
    add_action( 'wp_print_styles', 'us_filter_styles' );
    Thread Starter catmaniax

    (@catmaniax)

    Thanks, but a native option in the plugin’s setting will be the best solution.

    Plugin Author Heateor Support

    (@heateor)

    We will do it ASAP. We are planning to release a pro version of the plugin that would be much better in performance.

    Thread Starter catmaniax

    (@catmaniax)

    I see.

    What will the premium version offer and around when will it be released?

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Do not load plugin’s files in pages!’ is closed to new replies.