3

I downloaded all files from wp-content/uploads and copied to new Wordpres instance on localhost (Windows IIS Express also on MacOS with MAMP). Unfortunately in both cases I don't see my files in Media Library. Isn't just needed to copy and paste files to wp-content/uploads to get access to them fom new, completely clean instance of Wordpress? Strange is the fact that all newly uploaded files via Media Library are saved to the same location where I put my copied files.

For example, I have a folder wp-content/uploads/2016/04 and there are images transfered from online server via FTP. No one of them is visible via Media Library. When I upload a new file for example new123.jpg it's visible in media library and also ../uploads/2016/04/. But other files still aren't visible from wordpress.

I set privilages for all files and folders to chmod 777 equivalent. I had tried everything. I know how to copy database, change urls etc. All post and pages works.
Until today I just know that there is one way to download all images during import Wordpress, it's needed to check "download attachments".
But that's not solution, I'm sure that there should be the way to get access to files from /uploads/ just copied directly from another location.

I'll be very glad for any tips and help.

1
  • I completely agree. it's a total pain... the wordpress infrastructure should scan the directory and add the files to the database. Unfortunately it doesn't. I have looked for a plugin that might achieve this, but alas have not found one. You will have to upload the files again via the front end to have them added to the database.
    – Jim
    Apr 15, 2016 at 10:09

1 Answer 1

5

There are three ways you could do this:

1. Upload all into the Media Library

The most tiresome way, IMHO, is to upload all the images you got via the media library.

2. Use a plugin

You can use plugins like Add From Server to import your images easily to the Media Library

3. WP-CLI

Easiest way once you got WP-CLI installed. Run wp media import to import all images easily. Quoting an example:

# Import all jpgs in the current user's "Pictures" directory, not attached to any post
wp media import ~/Pictures/**\/*.jpg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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