I'm having issues with being able to get to my image files inside the Media Library. I'm having issues, since I have transferred my WordPress website from my local server to the live environment.

In the below screenshot you can see the files are in the correct directory:


enter image description here

I did try to also just drag and drop an image into my media library but get this error-" could not insert post into the database".

I double checked my permissions and they are correct with folders set to 755 and files set to 644.

My wp-config.php file is also setup to the correct table for my .sql database

Also, I included this code:

define('WP_MEMORY_LIMIT', '1024M');

to the wp-config.php file, so this isn't the issue.

Thanks for the help

  • Have you tried to regenerate your thumbnails? Plugins such as this will re-create the thumbnails from the image files in your media directory. en-gb.wordpress.org/plugins/regenerate-thumbnails. Depending how you transferred your wordpress site, the ID's may not match up etc anymore, try regenerate thumbnails on your live site.
    – wharfdale
    Nov 20, 2019 at 9:46

1 Answer 1


It looks, that there is a problem in your database, even more possible when you got "could not insert post into the database".

Have a look into your database, go to the wp_posts table and inspect entries with post_type "attachment". Here are the attachments saved in your database.

Pick several attachments and write down their ids. Then go to the wp_postmeta table and search the "post_id" with the id you wrote down. You should get additional information about the attachment, like the location of the file, etc. Are you getting those details correctly?

One more thing, make sure, that the database user has enough privileges granted for a selected database - this can be ofter set through cPanel or through some other hosting management dashboard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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