If your website uses PDFs to distribute key information, then you may want to know how to disable PDF thumbnails in WordPress. PDFs are some of the most used files in the world because they preserve the format of the file regardless of what device they are opened with. They are extremely useful for sensitive material like forms, contracts, bank statements, etc.
If these documents are sensitive, a thumbnail of the document could leak valuable information. For example, someone’s paycheck amount could be leaked through a thumbnail. Today I will demonstrate how to disable PDF thumbnail previews on your website using the built-in tools provided by WordPress.
Why WordPress PDF Thumbnail Previews Should be Disabled
PDFs can hold a plethora of different kinds of content, but sometimes that content is sensitive information. An automatically created thumbnail by default will show the first page as a thumbnail. Granted, most important documents are not posted on websites for anyone to view, but if you’re uploading your employee documents on the same website that your employees work on they may be able to see the important information they shouldn’t through a thumbnail. You must also be aware of the age of your users. If you are storing explicit adult content only suitable for mature audiences, a thumbnail of that content is not appropriate and should be hidden.
The Internet is not always using content legally either and it is better to hide these things by eliminating the thumbnail. For example, it should not come as a surprise that popular books and textbooks can be found for free online, but remember, it is illegal to upload them, and they tend to get taken down if the publisher discovers their location. Hiding a thumbnail can help you hide it if the default thumbnail ends up as the cover of the book.
How to Disable PDF Thumbnail Previews in WordPress
Today I will demonstrate how to disable PDF thumbnail previews on your website using the built-in tools provided by WordPress. Make sure you update WordPress to the latest version. This feature was introduced in WordPress version 4.7. If you are using one of the many PDF plugins for WordPress, then be aware that your plugin needs to be updated as many of these plugins handle creating and managing PDF thumbnails.
This is a very simple process and will only take a few minutes. Before you start, please review how to add code snippets in WordPress. Copy the following code snippet:
Now access your cPanel where your WordPress files are located. Click on the File Manager option.
Locate the wp-content folder. Go into the folder and find the themes folder. Inside this folder, you will see all of the themes that are installed on your website. Click on the one that is currently being used on your website. A large number of files will now be visible. Find the functions.php file, right click it and select the edit option.
You should get a warning window pop-up. Before editing any code files you should always create a backup of your content. This will ensure a swift recovery if you make a mistake. Scroll down to the bottom of the code. Look for a * Include Files line. Above this line paste the code snippet.
Save your work by clicking the “Save Changes” button on the top right.
If you upload a PDF on your website you should see the following thumbnail image.
Congratulations, you have successfully disabled your WordPress PDF thumbnail previews. Remember, if you change the theme on your website you will need to repeat these steps and edit the functions.php file in your active theme. Also if you are using a plugin to generate PDF thumbnails it will no longer work if you use this technique.
Be Aware of Sensitive Information
Most likely, the main reason you are disabling WordPress PDF previews is to protect sensitive information, explicit adult content, or even illegal information from being spotted by the wrong eyes. This is definitely one way to stop it, but if possible you may want to only allow people with accounts on your website to view these files.
Ultimately you need to be careful about the files that can be found on your website. If you do promote illegal uploads like books, textbooks, movies, video games, etc. it is important to understand that this can have serious consequences. Simply trying to hide them on your website won’t solve the problem. They will eventually be uncovered and you will be penalized according to the laws in your area.
Why do you want to disable PDF thumbnails from appearing on your website? How many PDFs do you keep on your website? Do you use any PDF plugins to create custom thumbnails?
Author: Chris Racicot
Chris is the Support Manager at GreenGeeks and has been with the company since 2010. He has a passion for gaming, scripting and WordPress. When he’s not enjoying his sleep, he’s working on his guitar skills and fiddling with 3d printing.