Caching and combining JS has been known to be an issue with other caching tools. If you do not require the extra performance of the SiteGround caching/optimization tools, you can:
- Disable the option to combine JS files (front end optimization screen).
- Disable / uncheck the option to “Remove Query Strings from Static Resources” option will resolve this error.
- Flush the cache, and reload the site again
Make sure that mobile caching is not set differently from the desktop as this will result in the desktop version working and the mobile version fails.
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—you may require assistance from the SiteGround support to apply this to your site:
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;
}
Code language: PHP (php)