WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / Technical: Child Theme / Disable WordPress PDF Preview Thumbnails for Property PDF Uploads

Disable WordPress PDF Preview Thumbnails for Property PDF Uploads

8 views 0

In some cases, when a property has no uploaded images but has a PDF file uploaded, WordPress can generate an image preview from the first page of the PDF.

This can make the PDF preview behave like an image attachment. If that happens, the WPResidence placeholder image may not be used, because the property is no longer treated as having no image.

This behavior depends on the server and WordPress media processing. It may happen on some servers and not on others.

  • When This Is Needed
  • Why This Happens
  • How to Disable PDF Preview Thumbnails
  • Important Notes

When This Is Needed

Use this solution if properties have no image uploaded, but a PDF file is uploaded, and WordPress creates an image preview from that PDF.

The usual result is that the PDF first page is used instead of the placeholder image set in:

Theme Options → Property Card Settings

If you want WPResidence to use the placeholder image when no real property image exists, you can stop WordPress from creating PDF preview thumbnails.

Why This Happens

WordPress can create preview thumbnails for PDF files. The preview is usually generated from the first page of the PDF.

On some server setups, this generated preview can be treated as an image attachment. This can affect how the property thumbnail or gallery image is detected.

WPResidence uses the placeholder image only when there is no image available to show. If WordPress creates a PDF preview image, the property may no longer be treated as having no image.

How to Disable PDF Preview Thumbnails

Add this code in the child theme functions.php file or with the Code Snippets plugin:

/**
 * Disable WordPress PDF preview thumbnail generation.
 * This prevents WordPress from creating image previews from uploaded PDF files.
 */
add_filter( 'fallback_intermediate_image_sizes', '__return_empty_array', 999 );

This code tells WordPress not to generate image preview thumbnails for PDF uploads.

Important Notes

This is a WordPress media behavior, not a WPResidence theme option.

This code affects new PDF uploads only. PDF files uploaded before adding this code may already have preview images generated.

If a PDF preview was already created, you may need to delete and upload the PDF again, or manually remove the wrong image/thumbnail from the property.

This code does not block PDF uploads. It only stops WordPress from creating image previews from PDF files.

Add this code only in the child theme or with a code snippets plugin. Do not edit the parent theme files, because changes in the parent theme can be lost after a theme update.

Please make a full backup before adding custom code.

Technical: Child Theme

Related Articles

  • Technical – How to Grant Access to Custom Post Type Capabilities for a Specific Role after 5.1.1 Theme Update
  • Technical How to: Child theme
  • Child Theme: How to add links to copyright message
  • How to install WpResidence child theme

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 39Elementor Shortcodes Built-In
  • 46FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 24Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language - Third Party Plugins
  • 6Other Third party Plugins
  • 21Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 37Property Pages & Layouts
  • 31Search & Filtering
  • 162Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 7Technical: Child Theme
  • 86Theme Options & Global Settings
  • 7Translations & Languages
  • 16WPBakery Shortcodes
  • 50WPEstate / WPResidence Translate Plugin
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 9WPResidence Elementor Studio

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API