Firstly you can upload the image using wp_media_handle as it returns attachment id.
Then try to add your desired metafields by passing the same id in each of them.
Related Posts:
- How can I add an image upload field directly to a custom write panel?
- Hook to get image filename when it is uploaded
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- Upload multiple images and insert them into custom html code
- Redirect to another page using contact form 7? [closed]
- Cleaning a filename after image sideloading a url that contains `%20`
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- WordPress discards PNG file when uploading plugin file
- Hook for validating and rejecting frontend image upload
- Caption Shortcode: what filter to change the image size?
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- Upload to a specific media folder created by FileBird Lite
- Is it mandatory to use $wpdb->prefix in custom tables
- PHP error with shortcode handler from a class
- Add self-closing shortcode button to TinyMCE in WP 4.6
- Checking if a file is already in the Media Library
- Saving data-URI to media library
- How to implement add_image_size in a plugin
- Are shortcodes case-sensitive?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- Changing upload directory for plugin uploads only
- Upload file to remote storage
- How to make WordPress use non-greedy shortcode parsing?
- Multiple Parameters for a Shortcode
- How is the data stored in the database?
- Actions or filters fired when data is saved in a custom table
- Front-End Form Submission in Shortcode
- Hook event for upload image in the menu
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- add_shortcode is not working [duplicate]
- Add media and attach images to pages
- How can I render shortcode so that its not cached by Caching plugins?
- Uploading images from a custom page using blueimp uploader?
- Processing shortcodes in groups (separated by line breaks)?
- Creating table with plugin is not working
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- What filter should I use to insert a button inside on Media>Add New
- Creating a shortcode, but getting tied up with OOP and Classes?
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- Auto gallery from folder contents
- add_shortcode() not working inside of function
- Strange issue saving custom field data for a WooCommerce order
- How to enable sorting in custom media uploader in plugin
- Form doesnt save to database
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- How to Upload Images From a Folder (Not WP_Uploads)
- Custom login doesn’t work properly
- Ho to add “Create Slider” option to default “Add Media” popup?
- Run Shortcode of post’s custom field in functions.php / Plugin
- Display list of uploaded images, filtered by user under a specific user group
- wp_nonce_field displaying twice
- wp_editor add media button not working
- What is the best way to store a few fields?
- Delete data from database using row action
- Using a custom shortcode from within the template of a shortcode plugin
- When echoing my own shortcode, it keeps adding a 1 at the end of my blogpost
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- Which is the better way to store images for the plugin?
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- Automating the process of shortcode generation in a plugin – how is it done?
- How do I change the image from the default mysteryman in the WP Profile page
- Create Widget or Enable Shortcodes in Sidebar
- Conditional Generation of Image Sizes using add_image_size
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- add_filter img_caption_shortcode not implemented
- How to insert HTML/CSS/JS into my iframe plugin?
- Resize not resizing images with Capitial extension like JPG
- Why doesn’t update_post_meta work for certain strings?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Font size of HTML content
- wp.media Uncaught TypeError: Cannot read properties of undefined (reading ‘state’)
- Error code when migrate
- Adding the image selector/uploader to an admin back page
- How to write a custom shortcode name book?
- WordPress Iframe for blog image
- Use admin-post to submit form data to external database
- Pass javascript result to shortcode executer function
- How to store in the database directly the translation?
- Shortcode from a plugin not working
- Ajax not working to insert, query and result data
- Associating special meaning with user id 0
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- What method should I use to store my plugin data (multi level menus with options on each item)
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- How do you filter get_media_items by mime type in a custom media upload tab?
- upload script in plugin development [duplicate]
- WordPress simple ‘Hello World’ plugin – problems
- Using “add_image_size” to register custom image sizes inside plugins not working
- Shortcode rendered in preview, but empty in post
- Add a custom image source
- upload image to wordpress media library failed for custom post type
- wp media uploader and ID3 tags
- WordPress Playground and uploading permission issue
- Custom database table entry edit page
- Resending woo-commerce order emails from frontend
- How to get list of ALL tables in the database?