Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there any plugin which creates a new post from each image I upload/select with it?

I want to create many posts with one image per post. Currently I select, upload all images. Then create new post, name it same as image file name, insert image from media library and then save to draft/publish it

share|improve this question

closed as off topic by Rarst Dec 8 '12 at 11:21

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

add_action('add_attachment', 'create_post');
function create_post( $attach_ID ) {

    $attachment = get_post( $attach_ID );

    $my_post_data = array(
                'post_title' => $attachment->post_title,
                'post_type' => 'post',
                'post_category' => array('0'),
                'post_status' => 'publish'
    );
    $post_id = wp_insert_post( $my_post_data );

    // attach media to post
    wp_update_post( array(
        'ID' => $attach_ID,
        'post_parent' => $post_id,
    ) );

    set_post_thumbnail( $post_id, $attach_ID );

    return $attach_ID;
}
share|improve this answer

I've found a plugin named YAPB (Yet Another Photoblog) that does exactly what you need, in combination with YAPB Bulk Uploader. You can find the plugin and info here: http://wordpress.org/extend/plugins/yet-another-photoblog/

share|improve this answer
    
Unfortunately the YAPB programmer took only half the way as YAPB creates it's own library and thumbnails - which leaves the user with an empty wordpress media library and without the possibility to (without coding) use the YAPB thumbs as post-thumbnail. As I understand it, the developer was aware of the flaw but abandoned the project before changing this in order to give users the opportunity of using the YAPB plugin without losing important benefit from the built in WordPress features by creating a box in the box. –  Sven Knoch Nov 7 '12 at 16:45

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