#StackBounty: #custom-post-types #uploads #post-thumbnails #media #pdf Force documents to appear in Featured Image dialogue

Bounty: 50

Having a perplexing issue… …for a custom post-type called ‘Resources’ I used the ‘Featured Image’ or ‘thumbnail’ function within WordPress to allow users to attach documents to ‘Resources’. The process itself works exactly as expected and anticipated.

However, setting the site up, someone made a mistake and uploaded two documents and assigned them to the wrong ‘Resources’. So Resource A -> Document B and Resource B -> Document A.

When attempting to switch them and clicking ‘Edit Featured Image’ you are unable to see any of the documents. They clicked ‘Remove Featured Image’ and then ‘Set Featured Image’ and when the dialogue opens, still no documents.

In the WordPress Media Library all of the uploaded and attached documents are there. Visible, with previews, etc. As expected. Here’s the first two rows of the Media Library. You can see tons of PDFs that have been successfully uploaded.
Media Library

The only place where this issue appears is that in the actual ‘Featured Image’ media dialogue box, WordPress will not display any PDFs.

Here’s the CPT supports segment:

$rsc_supports = array(
     'title',
     'editor',
     'thumbnail',
     'page-attributes'
);

Like I said, everything works perfectly – even uploading and attaching PDFs as ‘thumbnails’ to be associated as attachments with the CPT. When a PDF is attached and you ‘Click to edit’ the dialogue opens up and you can see the attached PDF in the list.
The only failing is that the ‘Featured Image’ modal/pop-up/dialogue box that loads, is designed to filter out everything except images.
This is what that dialogue box looks like on a ‘Resource’ with nothing attached.
Featured Image Dialogue

However, if you view another Resource that does have a PDF already attached, you get this:
With PDF Attached

I have tried the filtering and date dropdown and they don’t address this.

I believe this is by design. So my question is, “How do I modify that dialogue box to display all files rather than just images?”


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.