I know how to upload multiple images into an existing post, but this is a different scenario. This is for a large catalog of assets, with each custom post-type post representing an image asset (thus a single image is assigned as the “featured image” for each post).
The whole system works great for one-at-a-time asset creation, but far too time-consuming. I need to be able to “batch” upload multiple images at once, then have a new post created for each image, then attach the image to the new post as the “featured image”.
There will be no text content entered for each post – just some metadata and custom taxonomy assignments, so it should be possible to batch-assign the metadata and taxonomy during this batch creation process.
I’ve researched solutions from XML-RPC post creation (which doesn’t usually handle image upload/assignment) to plugins that pull files from a server directory to the media library (which doesn’t cover post creation), and jquery multiple file uploaders (that basically just dump files in a directory).
I am relatively versed in php, having built plugins and themes, but I’m stumped at how to handle this process, as it requires the first step of getting the files to the server in some temporary capacity, then generating posts based on the files uploaded, and assigning some identifying metadata to the whole batch.
I’m hoping this can be done in a custom admin panel, but if I have to do this outside of wp-admin, that’s fine too…
Ideas?
There is this plugin: Automatic Featured Image Posts Plugin
From the plugin page:
Automatic Featured Image Posts creates a new post with a Featured Image every time an image is uploaded. Through the plugin settings page, you can set the image to publish and assign itself to one of your other existing custom post types and/or post formats.
Basically, every image that is uploaded generates a post (of your chosen post-type) and is set as the featured image of that post.
I installed this on my local machine. The settings page looks like this and allows you to select which post type, including custom post types, you want to assign photo uploads to, and what publish status you want.
![Screenshot of plugin](https://i.stack.imgur.com/nFWg9.png)
To put the plugin into practice – navigate to your chosen post type, open a new post and upload media.
To bulk upload photos, simply highlight multiple photos in the “upload” dialogue box. I’m highlighting 8 photos here, but I see no reason why it couldn’t be 80 or 800, unless there are limits I don’t know about in the wordpress image uploader.
![enter image description here](https://i.stack.imgur.com/USt5n.png)
The titles of the posts are set by the image file names. You should be able to work with that and call them in your theme with the_title()
I tested locally and it’s working in WordPress 3.6.
I’m sure there is a more robust or flexible way to accomplish this, but in this case, the plugin seems to do exactly what you’re asking, with the exception of assigning meta-data. Maybe someone else could flesh that part out a little bit.
If you needed dynamically generated post content, you could at least start with the plugin and iterate from there. One thought there would be to use post-formats or page-templates to determine how the posts are displayed.
Note: Make sure you have all your image_size
s set in functions.php. I’d hate to have to undo / delete 10,000 photos, or run an extremely long “regenerate thumbnails” just because I forgot or changed the image size!