PDF Embedder Documentation

Documentation, Reference Materials, and Tutorials for PDF Embedder

Get access to
Powerful Features!

Home » Documentation » Troubleshooting Errors » Using Caching or Minifying Plugins

Using Caching or Minifying Plugins

Do you have caching or minification enabled on your site? Using plugins to minify and/or cache the scripts running on your site has been known to create issues with the PDF Embedder functionality, causing the PDF viewer to break, show a blank space, or throw JavaScript errors. This is a known compatibility issue. The fix is to exclude the PDF Embedder scripts from those tools.

This guide highlights the common caching plugins, explains script paths to exclude, and covers the specific configuration needed for Hummingbird and WordPress.com’s Page Optimize tool.


Which Caching to Check

Here are some of the plugins that are known to cause issues if configured incorrectly:

Plugin NamePlugin URL
WP Super Cachehttps://wordpress.org/plugins/wp-super-cache/
W3 Total Cachehttps://wordpress.org/plugins/w3-total-cache/
WP Rockethttps://wp-rocket.me/
Autoptimizehttps://wordpress.org/plugins/autoptimize/
Jetpack Boosthttps://wordpress.org/plugins/jetpack-boost/
LiteSpeed Cachehttps://wordpress.org/plugins/litespeed-cache/
WP-Optimizehttps://wordpress.org/plugins/wp-optimize/
WP Fastest Cachehttps://wordpress.org/plugins/wp-fastest-cache/
Page Optimizehttps://wordpress.org/plugins/page-optimize/
Airlifthttps://airlift.net/

Some themes also allow you to configure caching/minifying of JavaScript files. So you should look for relevant options in your theme settings area.

Why Caching Causes Problems

PDF Embedder’s JavaScript files have versioned filenames. When a caching or minifying plugin combines, renames, or serves a stale cached copy of these scripts, the viewer cannot initialize correctly. Excluding the PDF Embedder scripts tells your caching plugin to leave them alone and serve them directly.

The PDF Embedder plugin scripts are already minified, so excluding them has no impact on site performance.

Script Paths to Exclude

Add the following paths to the exclusion list in your caching or minifying plugin.

Free version

/wp-content/plugins/pdf-embedder/js/all-pdfemb-basic-4.6.24.min.js
/wp-content/plugins/pdf-embedder/js/pdfjs/pdf-4.6.4.min.js
/wp-content/plugins/pdf-embedder/js/pdfjs/pdf-4.6.4.worker.min.js

Premium version

/wp-content/plugins/PDFEmbedder-premium/assets/js/pdf-viewer.min.js
/wp-content/plugins/PDFEmbedder-premium/assets/js/pdf-worker.min.js

If you upgraded from an older version (v4.x, v5.0.x, or v5.1.x), your plugin folder may use a different name, such as PDFEmbedder-premium-secure. Check your /wp-content/plugins/ directory via FTP or your host’s file manager to confirm the correct folder name before adding the paths.

After adding exclusions, flush your cache and do a hard reload in your browser.

Each caching plugin has its own interface for exclusions — refer to that plugin’s documentation for where to enter these paths.

Hummingbird

If you use the Hummingbird plugin and the viewer is broken, try the following options in order.

Option 1: Enqueue the worker script manually

Add the following code to your site, adjusting the version number in the file path to match your installed version:

wp_enqueue_script( 'pdf-embedder-worker', plugins_url( 'pdf-embedder/js/pdfjs/pdf-4.6.4.worker.min.js'), array(), false, false );
Code language: PHP (php)

Add this code using one of the following methods:

Method 1 – WPCode (recommended): Install the free WPCode plugin, go to Code Snippets > Add Snippet, paste the code, and activate it.

Method 2 – functions.php: Add the code to your active theme’s functions.php file.

Option 2: Disable URL query strings

In Hummingbird, go to Advanced Tools > General Settings and disable the URL Query Strings option.

Option 3: Exclude the scripts from the page cache

In Hummingbird’s page cache settings, add the PDF Embedder script paths listed above to the exclusions list. After making this change, flush the Hummingbird cache.

WordPress.com Page Optimize

WordPress.com uses the Page Optimize tool rather than a standard third-party caching plugin, and it requires a different exclusion method.

Instead of file paths, Page Optimize uses data-handle attribute values. Add the following handles to its exclusions for both JavaScript and CSS:

  • pdfemb_embed_pdf_js
  • pdfemb_pdfjs_js

Find these by viewing the source of a page where you have an embed. The handles appear in the <script> tags. Enter them into Page Optimize’s exclusion field.

Still have questions? We’re here to help!

Last Modified: