Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

my Media -->Library content disappeared from the dashboard, but I still can see it inside my actual site folder.

Could anyone instruct me how to fix it?

Thank You

share|improve this question
    
1. what steps did you take to upgrade (automattic ?) 2. check your media settings for the upload media folder location. –  krembo99 Mar 7 '13 at 4:30
    
Hi, Krebo99, I do not see media 's folder location in setting-->media. Do you know how can I find it or modify it? Thank you! –  Adam Mar 7 '13 at 12:46
    
I am sorry, My bad , this setting field was REMOVED in 3.5 , and I never even noticed it´s removal...anyhow when you say it disappeared from dashboard, what exactly do you mean ? can you see the contents when you do upload media for example ? do you see any error messages ? –  krembo99 Mar 8 '13 at 3:41
    
hi Krembo, thanks for replying, I am able to upload new stuff. no error msg at all, just all the image I had in the library are all gone from media library but they actualy still sit inside the site folder in FTP view. –  Adam Mar 8 '13 at 8:51
    
you mean when you go to the media -> Library -> all , you see nothing ? and you can still attach new images , but then again, not see them ? –  krembo99 Mar 8 '13 at 10:00

2 Answers 2

premise :

I am not so sure as to the exact reason of your problem, but after the comments, and considering a normal "user" level of coding expertise, I post this answer describing not the ultimate solution, but the steps that I myself would have considered when facing a similar problem. There might be better approaches and I would love to hear them, but like I said, I am posting this as an option to a normal user without coding or debugging capabilities.

Strangely enough , yesterday , while commenting to you , a similar thing happened to me on localhost . After a short investigation, I found out that one of my DB tables (wp_posts) was damaged (first time in 6 years of WP´ing ) .

enter image description here enter image description here

The symptoms were :

  • All attachments gone (but still on server).
  • Can not publish new posts ( only submit to preview )
  • Can not attache new images

AS the symptoms might differ from yours , and so does the recovery , It still leads me to think that you have some damaged DB table ..

So, in order to fix this , you can do one of three things :

1 - Reinstall your website completely including DB

That depends on how much content you have on the website and on how much time you want to invest in total recovery.

you will essentially need to Copy and paste , upload all images , create new categories and posts . No import is suggested since we are talking about DAMAGED tables where the information relations themselves are damaged .

2 - Trying to RESTORE the damaged table .

GO into your PhpMyadmin, and goto YourDB-->structure then flag your tables (maybe one by one ) and choose "restore"

enter image description here

3 - Try to handle the visible symptom of lost attachments only while ignoring other possible yet-to-be-discovered problems :

While it would be the less recommended for me , it might be the first try for someone with a lot of content and little time .

In that case, I believe your easiest option would be to try to reload all the images . But there is a catch. If you will upload them AGAIN to the same uploads folder wordpress will try to avoid conflict naming and will rename them with sequential numbers ( eg. image.jpg will be uploaded like image1.jpg etc ...) which will cause them not to be recognized as the original inserted images ..

So you need to BACKUP you uploads folder to another location, and then DELETE all the images from the wp-content/uploads folder . At this point , you need to UPLOAD them again from the backup folder , and attach. (thus maintaining the same names )

You could :

  • Do it manually on each post (but if you choose this option, it is already better to choose recovery option NO.1. )
  • Use some plugins like add-from-server and then another one like unattach-and-re-attach to resolve the problem.
  • depending on how automated your site is , and how it is coded , you have a third option of attaching all the images only to ONE post in order to "uplaod" them and assign GUID , and then they will be recognizable again as inserted images , but this option is reserved to someone who knows the code well and can handle automattic assignment of post thumbnails and featured images etc ..

Note that in order to maintain the same names , you will have to upload only the ORIGINAL sizes and not the custom sizes (meaning image.jpg and not image-800x600.jpg )

Making a long story short , There is no easy solution as far as I can see for such a problem , but to prevent it in the future , regularly backup of your DB is always a good advice.

WILD GUESS EDIT Also , in the comments you said that you have deleted a user and then "restored" posts from the DB . This can be also the root of the problem, although hard to confirm.

In this case what you will need to do is something like this :

UPDATE wp_posts SET post_author=NEW_AUTHOR_ID WHERE post_author=OLD_AUTHOR_ID;

But next time, when you delete a user, make sure that you assign all the posts to another user before deleting it .

share|improve this answer
    
Wow, thanks for the answer I am going to check it out soon! Will post reply! –  Adam Apr 13 '13 at 11:55

OK so you dropped the wp_posts table data and then restored the posts from trash. It must work if Wordpress did not stored the media library entries in wp_posts table. The problem is all the entries had removed, there is no record pointing to the uploaded image so Wordpress does not recognize it!

You can see it yourself, open phpMyAdmin or any other MySQLClient and browse the wp_posts table, then observe post_type column, there must be some record with type 'attachment', and yes, these are those media you uploaded recently. Older entries with type 'attachment' are not exist anymore, as you deleted them. If you have a back up or something you probably can restore those only attachment data by selecting and exporting them. Maybe this can help you :

http://wordpress.stackexchange.com/a/95683/31384

share|improve this answer
    
Thanks! Will check it out! –  Adam Apr 13 '13 at 11:55
    
Op has said that he can see the attachments on the media library , so they are presumably not deleted , just the post they were attached to .. –  krembo99 Apr 14 '13 at 1:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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