- December 12, 2016
- Posted by: Sadman Sakib
- Category: WordPress Tutorial
Recently, one of our readers asked us how to disable PDF thumbnail previews in WordPress. Introduced in WordPress 4.7, this feature creates thumbnail images for all PDF files that you upload. In this article, we will show you how to easily disable PDF thumbnail previews in WordPress.
Why Disable PDF Thumbnail Previews in WordPress?
WordPress 4.7 started generating thumbnail previews of PDF files uploaded from WordPress media uploader.
This is a very useful feature for most WordPress sites.
However, some site owners may already be using PDF plugins that handle thumbnail previews and the overall display of the PDF downloads on their website.
If the new feature is conflicting with their existing PDF uploads, then they may want to disable PDF thumbnail previews in WordPress.
Having said that, let’s take a look at how to easily disable PDF thumbnail previews in WordPress 4.7 and later versions.
Disable PDF Thumbnail Previews in WordPress
This tutorial requires you to add a simple code snippet on your WordPress site.
You will need to add this code to your theme’s functions.php file.
function wpb_disable_pdf_previews() { $fallbacksizes = array(); return $fallbacksizes; } add_filter('fallback_intermediate_image_sizes', 'wpb_disable_pdf_previews');
Don’t forget to save your changes.
This code simply gives WordPress an empty array for PDF thumbnail sizes and stops WordPress from generating thumbnail previews.
You can now try uploading a PDF file to your WordPress site using the media uploader. You will notice that WordPress will not generate any thumbnail previews for your PDF file.
We hope this tutorial helped you learn how to disable PDF thumbnail previews in WordPress.