Links in pdf dissapear after uploaded to WP Media library

Skip to first unread message

Ian Anderson Gray

Nov 13, 2020, 8:26:17 AM11/13/20
to Manchester WordPress User Group
Hi everyone.

I have a weird situation with a client's website.

When they upload PDFs to their media library, hyperlinks disappear.
Does WordPress do anything to PDFs when in the library?

I have Imagify installed, but that only affects images I think.


Andreas Andrews

Nov 14, 2020, 1:11:47 PM11/14/20
to Manchester WordPress User Group
Hi Ian,

I'm wondering what to suggest off the top of my head, other than asking a few questions:

- Are the images disspearing from the server or just the hyperlinks/URLs?
- Are you seeing an error such as a 404 page not found or anything like that or is it literally the only clue you've seen is that some links are missing from somewhere they should be?

Because WordPress doesn't natively embed PDFs (unless things have changed recently) it handles them differently to other media you upload to the server (which can be done through the back-end aka dashboard or via your hosting control panel, FTP or commandline. On a basic level you should be able to add the PDF to the relevant folder in your 'uploads' sub-directories and then work out that URL and post that on your post/page and see if that links to the PDF download/view action that you had intended.

Assuming you're using an install that is up-to-date and also perhaps using blocks perhaps the default behaviour now is that it might create a download button which you can modify. I'm also assuming you don't have a plugin installed to embed PDFs as that could effect the default behaviour.

Personally I would likely inspect both the content in the page you're editing, any page builders you're using (ie. Elementor) and their own editing pages where the content appears and the links have dissapeared and then also maybe the source-code using the property inspector or developer's tools in your chosen browser (Chrome & Firefox) which is often accessed with F12 or by right-clicking the element on the page that you want to expect, such as where you hyperlinks should be appering on the pages/posts on your site or anywhere around that area. Knowing and understanding what to look for is a whole other story, but you could start by searching 'PDF' or any specific filenames you're looking for and see if they are in the source code but not visible generally.

To find out if it is indeed a plugin causing the issue you can guess which ones and start disabling, testing/refreshing and then re-enabling those (but perhaps on a non-live, testing version of the site if you have a staging server - some hosts and cPanel modules and installers offer them included for easy testing) and definitely with full backups and disaster recovery in place that you know you can easily restore if need be, just in case.

Also, perhaps it's worth testing with a fresh PDF with no spaces in the filename. I know Linux systems doesn't always like spaces even though WordPress handles them fine usually.

Changing lots of things things at once might help fix it, but doing it more methodically one thing at a time helps me to learn what caused the issue so it doesn't happen again and so you're not doing too many changes which might break other things.

I  hope my ramblings have been helpful!


[andreas @ andreasandrews . com] - my email you might see -  'mail@' -  linked to this Google Group is not monitored as much in case anyone wants to email me...
Reply all
Reply to author
0 new messages