How to Disable PDF Thumbnail Previews in WordPress

How to Disable PDF Thumbnail Previews in WordPress

PDF thumbnail previews in WordPress is a new feature introduced in WordPress 4.7. This feature creates thumbnail images for all the PDF files that you upload to your website. However, not all of you might find it useful. We have received a few questions on how to disable it from our readers. So, today we’ll show you how you can disable PDF thumbnail previews in WordPress easily.

Why to Disable PDF Thumbnail Previews in WordPress?

The PDF Thumbnail Preview is a very useful feature for WordPress websites. It shows the first page of the PDF as a thumbnail and is better for visual performance.

However, some websites may already be using plugins that handle thumbnail previews and display of the PDF such as PDF Thumbnail or PDF Image Generator.

The new feature may be in conflict with their existing PDF uploads, and the website owners may want to disable PDF thumbnail previews in WordPress.

Therefore, here’s how you can disable PDF thumbnail previews in WordPress 4.7 easily.

Disable PDF Thumbnail Previews in WordPress

The task at hand is very easy. In order to disable PDF thumbnail previews in WordPress, all you’ll need to do is add a simple code snippet on your WordPress site. You will need to add this code to your theme’s functions.php file or a site-specific plugin.

1. function wpb_disable_pdf_previews() {
2. $fallbacksizes = array();
3. return $fallbacksizes;
4. }
5. add_filter(‘fallback_intermediate_image_sizes’, ‘wpb_disable_pdf_previews’);

After you’ve pasted the above code, save your changes.

This code gives WordPress an empty array for PDF thumbnail sizes. It stops WordPress from generating thumbnail previews. Now, if you try uploading a PDF file to your WordPress site using the media uploader, WordPress will not generate any thumbnail previews for your PDF file.

We hope this tutorial has been helpful. We hope you learned how to disable PDF thumbnail previews in WordPress.

 

Reference: WPBeginner

Leave a Reply

Your email address will not be published. Required fields are marked *