A client of mine moved his wordpress site from his servers to ours. But there were several errors that came with the migration:
- No files could be uploaded
- No thumbnails could be seen on the media menu
- Neither folders
- And sometimes the site broke blank
These are the steps we took to fix that:
- Checked the primary keys on the tables: _post and _postmeta .
- The migration didn't copy the primary keys and I had to create a whole new table _post2019 with the primary keys (not null, autoincrement)
- copy everything from _post to _post2019 and rename _post to _postold
- and then rename _post2019 to _post
This solved the database issues. Permissions weren't a problem this time but I also checked everything was writeable as 755 for folders and 644 for files
Now back to Wordpress,
- Checked in options if it had a faulty upload_path. I left it blank so it could take the default value.
- I went to the tools section and the fix media library. It gave me so many errors the first time with 550 files that I had to go to the options button on this tool
- At the options section of th fix media library tool, I set this up as:
Unreferenced Thumbnails: don't analyze
Broken attahments: delete
Duplicate attachments: delete (not 'delete even if attached to different')
Post GUID: update if there is a mismatch
Unreferenced images: don't analyze
Logging to: wp-content/uploads/media-library.log
Verbose logging: checked
I opened the log file with SSH and checked for errors. Even if the first runs gave me errors, I finally made it to fix all thumbnails and image references and all thumbnails showed up and files could be uploaded.