felipe.lavin.blog

On making stuff with code. And making code to do stuff.

How to enable PDF thumbnails on WordPress

First, you need Ghostscript and Imagemagick installed on the server. If in doubt, run sudo apt install ghostscript php{YOUR_VERSION}-imagick

Then, check if the security policy allows PDF read/write. For instance, on a Debian 12 installation you would check /etc/ImageMagick-6/policy.xml

Check if there’s already a “PDF” policy and edit or add the following line:

<policy domain="coder" rights="read | write" pattern="PDF" />

If you’re using PHP as FPM, you will need to restart the FPM process and then it should be available.

If you need to debug deeper, check the class-wp-image-editor-imagick.php file around line ~143.