I am migrating a very big website to wordpress.
I have about 35,000 images that I need to migrate to the wordpress environment from a custom cms made in native php.
I have uploaded the files via ftp to the wp-content
directory but the wordpress media does not seem to recognize it, since it’s missing the meta data in the mysql database.
I found the “add from server” plugin, but that plugin is limited to manually selecting images but when I select many images at once, it crashes.
Are there any other solution out there?
Use RecursiveDirectoryIterator in conjunction with RecursiveIteratorIterator. Then use wp_insert_attachment to add them to the WordPress database.
Note: I was not able to test this, but this is the general concept.
When I was migrating a site with more than 55345 articles with images, I wrote some pure PHP scripts that perform migration, and then inserted images as follows (based on the explanation given by jackreichert):