I have hundreds of PDFs that are linked throughout my site, and these PDFs all have a unique document number and revisions. e.g. 902367 version I
What I would like to do is have a defined slug for each document, such as mysite.com/902367/ that would link directly to the document. Redirects are one way to accomplish this, but even with REGEX this would be sloppy and less than ideal.
I found one other question explaining that if your theme had an attachments file, that any attachments uploaded to that page would fall under the same category. However, that does not really apply to my situation as I am not trying to assign PDFs to a category, or a page, but rather essentially making them a page themselves. Is creating a pseudo page for the document the cleanest way to accomplish this?
What would be the most eloquent way of applying WordPress slug functionality to my PDFs?
add_rewrite_endpoint
and match something likemysite.com/pdf/<id>
and then usetemplate_redirect
to serve the requested file. – Laxmana Apr 4 '17 at 13:42