Attach additional $_POST data to image_advanced upload

Support Meta Box AIO Attach additional $_POST data to image_advanced upload

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #49692
    Paul WenzelPaul Wenzel
    Participant

    Enterprise-level site with terabytes of images. Trying to pare that down moving forward, so rather than every image upload processing to every image size, we're trying to restrict image processing to specific sizes for specific post types/pages/etc.

            [
                'id'      => 'ebook_image',
                'name'    => 'Ebook Cover',
                'type'    => 'image_advanced',
                'tab'     => 'event',
                'max_file_uploads' => 1,
                'image_size'       => 'ebook',
                'visible' => ['type', '=', 'Ebooks'],
            ],

    BUt on upload, the only data is the image name, post ID, and some other more or less useless information for this:

    Array
    (
        [name] => Ebook.png
        [action] => upload-attachment
        [_wpnonce] => ee8d7718b2
        [post_id] => 12189524
    )

    Is there any way to attach more data to the upload, suce as the field ID?

    #49703
    PeterPeter
    Moderator

    Hello Paul,

    Thanks for reaching out.

    Meta Box is using the Media Library of WordPress to upload images when you use the image_advanced field. You can try to use the filter hook plupload_default_params to modify the params sent to the upload function.
    Please check this filter here https://core.trac.wordpress.org/browser/tags/6.9/src/wp-includes/media.php#L4438

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.