Skip to content
Advertisement

WordPress media library broken after uploading PDF

I uploaded multiple PDF files to a wordpress site i take care of. I used the admin-dashboard to upload those. So here is the problem:

Anything worked fine before hand, I did not change any plugins nor did I update anything. Files were shown as usual. After uploading these multiple PDFs however, the media library no shows, it’s empty (see pic).

Text in middle area says: No Mediadata found

If I change the view to list view, it shows the following:

Names of the files are “(no title)” and in the back it says “(not linked)”

And now for the weird part: The data is still there. Not only on the FTP-server, even in the media library. If I filter for Pictures/Audio/Video/etc., all those show up correctly – except for documents, that does not work.
But if I filter by month and go through the month – everything shows up, even the old documents!

Only the newly uploaded documents don’t show up or cause this phenomenon in the pictures above.

Plus, if I try to upload data now, it fails, so thats a big problem.

So, what is going on? I guess, there’s a linking error in the database – but how do I resolve this? I do have access to the remote FTP-server, but how can I access the actual database? I did not find any files, that match the database name stated in the wp-config.php.

Is this fixable? Because I tried my very best and I’m stuck now.

EDIT: After days of asking I found out, that we have cPanel for this. So I got access to the wordpress database and simply deleted the rows with the problematic items. The media library does show every item again, in Grid and Listview. It just still doesn’t let me upload anything.
The error shown says “an error happened during the upload.” – very helpful. I noticed though, that the files get uploaded to the server, they just don’t show up in the media library. When using the file uploader, wordpress’ progress bar gets stuck on “Processing …”.

EDIT 2: It’s not just images and files. Everything new gets saved with the ID “0” in the database, so I guess there’s an error when grabbing the current ID? But how to fix it?

Advertisement

Answer

I’ve got it now, finally. Somehow all my tables in the database lost their primary keys and their auto-increment feature. So obviously wordpress added new entries with ID = 0, but wordpress starts counting at 1, this is, what broke my media library.

I just went ham and replaced every table with a new one and copied the old values. This solved the problem. The wordpress documentation helped a lot!

https://codex.wordpress.org/Database_Description

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement