• Resolved medlemark

    (@medlemark)


    from field type :

    A file uploader that allows you to add as many files as you want. Once added, files can be dragged and dropped to reorder.

    This is a repeatable field, and will store its data in an array, with the attachment ID as the array key and the attachment url as the value.

    uploaded 10k images to my custom uploads folder wp-content/uploads/my-custom
    and using while loop i have generated attachment for all my images that are inside my-custom folder using
    $attach_id = wp_insert_attachment();
    how can i link to CMB2 file_list i tried to build it manual like this but did not work
    a:1:{$attach_id:”url-to-image”}
    how can i insert file_list using custom code based on attachment id and url ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    What’s the CMB2 configuration you’re using for this?

    Essentially, you’re going to need to create an array of your items, and save it to the appropriate meta field for each post you want to set up. Hard to say how well one meta field may handle that many images, as well.

    Based on the small snippet you provided above, it’d essentially be like such that you need to save:

    $images = array();
    $images[ $attachment_id_1 ] = 'attachment_id_1_image_path';
    
    ...
    
    update_post_meta( $post_id, 'some_meta_key', $images );
    

    Should be a start and help get the brain rolling a bit here. Feel free to ask for more help or clarification as necessary.

    Thread Starter medlemark

    (@medlemark)

    i didn’t think of it is clear now thank you very much for hint .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CMB2 file_list issue ??’ is closed to new replies.