• Resolved cultedigital

    (@cultedigital)


    Hello,
    Thanks for this great plugin!

    My website is hosted on Siteground. I’m using there optimization plugin SG Optimizer and have enabled the “Combine JavaScript Files”.
    This features doubles the performance results for my site but unfortunately results in your plugin returning the following message:
    Setting up fake worker failed: “Cannot load script at: https://…

    Within the SG Optimizer plugin they have the option to Defer Render-blocking JS.

    I’ve found your posts covering this issue:
    https://ww.wp.xz.cn/support/topic/setting-up-fake-worker-failed-wp-rocket/
    https://wp-pdf.com/kb/setting-up-fake-worker-failed-error-message/

    I’ve tried “excluding /wp-content/plugins/pdf-embedder/(.*).js” but this doesn’t seem to, be picked up by the SG Optimizer, or work…

    For info, I use your plugin in the mobile version of my site.

    Would you have any suggestions?
    Thanks in advance,
    Nick

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @cultedigital,

    If you are unable to disable the combine JS settings, the alternative would be the specifically exclude the PDF Embedder scripts and this would require that you dip into some PHP coding to do so. An example of the code you would need to add to the functions.php is as follows:

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
        $exclude_list[] = 'pdfemb_embed_pdf_js, pdfemb_pdf_js';
    
        return $exclude_list;
    }
    
    add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
    function js_minify_exclude( $exclude_list ) {
        $exclude_list[] = 'pdfemb_embed_pdf_js, pdfemb_pdf_js';
    
        return $exclude_list;
    }
    
    add_filter( 'sgo_css_combine_exclude', 'css_combine_exclude' );
    function css_combine_exclude( $exclude_list ) {
        // Add the style handle to exclude list.
        $exclude_list[] = 'pdfemb_embed_pdf_css';
    
        return $exclude_list;
    }
    
    add_filter( 'sgo_css_minify_exclude', 'css_minify_exclude' );
    function css_minify_exclude( $exclude_list ) {
        // Add the style handle to exclude list.
        $exclude_list[] = 'pdfemb_embed_pdf_css';
    
        return $exclude_list;
    }

    If you have any other questions, please feel free to send an email to [email protected] as we may not see messages posted here to respond in a timely fashion.

    Thread Starter cultedigital

    (@cultedigital)

    Hello @wppdfsupport
    Thanks for your reply!

    The following worked:

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
    	$exclude_list[] = 'pdfemb_embed_pdf_js';
    	$exclude_list[] = 'pdfemb_pdf_js';
    
    	return $exclude_list;
    }
    
    add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
    function js_minify_exclude( $exclude_list ) {
    	$exclude_list[] = 'pdfemb_embed_pdf_js';
    	$exclude_list[] = 'pdfemb_pdf_js';
    
    	return $exclude_list;
    }

    Thanks again!
    Best wishes.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SG Optimizer – Combine JavaScript Files’ is closed to new replies.