How to disable PDF thumbnail previews in WordPress

If you’re using WordPress v4.7 or later, you’ll see an automatically generated thumbnail preview displayed when you upload a PDF file to a post or a page. While this is a great addition for most users, some admins may prefer to use a third-party plugin to perform the same task.

Should you wish to disable WordPress’ native PDF preview feature, you can do so by editing your theme’s functions.php file. You can do that using cPanel File Manager. Log into the HostPapa Dashboard and select My cPanel. Now select Files > File Manager.

cPanel

Navigate to your WordPress folder, then select app > themes. Now enter your current theme folder. Select functions.php and click Edit in the command bar.

File Manager

Copy and paste the following code into your functions.php file:

/**
 * Disable PDF thumbnail generation. 
 */
function disable_pdf_previews() {
$fallbacksizes = array();
return $fallbacksizes;
}
add_filter('fallback_intermediate_image_sizes', 
 'disable_pdf_previews');

 

Save the file, then head to the WordPress admin dashboard. Try uploading a PDF file using the WordPress Media Manager and you should find that no preview thumbnail is created.

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.

Related Articles

Get online with our affordable web hosting

Get online with our affordable web hosting

Learn more now
HostPapa Mustache