I want to create a simple website that stores PDF for search. The PDFs do not need to be searchable themselves (I mean, that would work, but there are only three items on each file so using custom meta fields would be simpler). Each PDF contains certain information and this could be added as custom fields which is probably easier.

First, I'd like to be able to duplicate the appearance of Media upload. Instead of uploading a PDF in a custom post type as an attachment, I'd like to be able to do this so that the default document title would be taken from the file name in the same way as it might be for an image. I've been unable to find anything that seems to allow me to do this? Is it possible? Is it so simple that I have missed it?

I'd also like to limit the upload to PDF only, I have found various questions on this and they seem to limit it to site wide (but for all users below ADMIN). Restrict file uploads by extension? This will probably be sufficient however, if it could be limited to only that post type, that would be ideal and leave the standard media unaffected.

Once this is done, I need to add some custom fields into the Attachment Details Screen. Instead of Title, Caption, Alt Text and Description I'd like different fields. For example, if this were a TV Episode, the meta might be "TV Series", "Director", "Writer#1", "Writer#2", "Writer#3". Again, seem to only be able to do this in a post/custom post type.

I would have expected this to be a pretty common thing to do but for the life of me I can't find the information online. Even when I see the image centric custom post type most of the recommendations include using the featured image option.

Can anyone point me in the right direction?


1 Answer 1


Did you try creating a custom post type, and adding custom fields with Advanced Custom Fields? Advanced Custom Fields makes it easily to add custom fields to a post, and gives the possibility to hide other elements, like the content editor and featured image.

In my opinion, you should create a custom post type, and add a custom taxonomy (tags) to it. After that, you create a custom field for uploading the file. In this way you can set a post title for each PDF-file, which most likely will improve your SEO score. In Advanced Custom Fields you can set the extensions that are allowed in the file upload.

For searching and indexing a custom post type with custom fields, I recommend using SearchWP. SearchWP has the ability to index and search through PDF's, so the content of the PDFs will also be indexed. It also gives you the possibility to set weight to custom fields, and create supplemental search engines to only show the results in PDFs.

  • Thanks for the feedback Jeffrey. It's very helpful. What you have described is my current understanding and I have created a number of post types before like this. With regards to SearchWP, I wouldn't want the PDF to be returned as a result separate to the custom post type. So I assume there is also an option not to search to PDFs too...? Commented Dec 31, 2015 at 8:31
  • Yep, there is an option to turn off PDF indexing. But I think it's also possible to return the parent post as a search result. Commented Jan 4, 2016 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.