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
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.