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:
- Images stored from external API not loading
- 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
- How should I store a log for my plugin
- How to create database table, add data, update and delete using wpdb via plugins?
- Auto gallery from folder contents
- Secure Pages Best Practice
- Adding option to Gallery shortcode
- add_shortcode() not working inside of function
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- Image upload appearing as broken images following server move
- How to serve different thumbnails/images depending on users browser/platform
- Strange issue saving custom field data for a WooCommerce order
- How to enable sorting in custom media uploader in plugin
- Create a new post using rest api and save featured image using an external image url
- How to perform a heavy and long process in cron jobs?
- 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)
- Why is the temporary upload always 4.1K
- Can’t upload image using media_sideload_image
- How to export post meta with images in wordpress
- Asynchronously render shortcodes in TinyMCE visual editor
- Get attachments from a post
- 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
- Plugin Development for registered users
- Putting a resized image into media library with wp_get_image_editor(
- Shortcode returning localized HTML part
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- Enumerating shortcode attributes in JavaScript
- Display list of uploaded images, filtered by user under a specific user group
- Optimising a big WordPress site
- wpdb->prepare and mysql UPDATE – how is it done?
- Wrap text around shortcode
- wp_nonce_field displaying twice
- dbDelta SQL Query Not Working
- dbDelta not installing database
- How to handle shortcodes through plugin
- Is it necessary to do validation again when retrieving data from database?
- wp_editor add media button not working
- What is the best way to store a few fields?
- Plugin: database creation
- Adding columns to core tables
- WordPress Specified file failed upload test
- How to query custom db table?
- Delete data from database using row action
- Show dynamic list of products from custom api of another database under same host
- Using a custom shortcode from within the template of a shortcode plugin
- Upload media only to DB
- 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?
- Uploaded attachment not set as featured image
- How do I change the image from the default mysteryman in the WP Profile page
- Make Database query only when option is updated
- Create Widget or Enable Shortcodes in Sidebar
- Can we intercept user_login and user_pass from a wp_login_form?
- Hook after attachment added and cropped
- How best to handle database version dependence (from $wp_db_version)
- Conditional Generation of Image Sizes using add_image_size
- shortcode executed in the page editor
- WP: Search and replace in DB programmatically
- Shortcode not appearing when used as post content in wp_insert_post() or possibly, shortcode not being registered at all
- Using AND and bracket grouping in SQL not working
- How to make my shortcode load scripts and styles, from within the plugin?
- how to change image of jquery slider plugin
- How to create a digital product download link that can’t be used twice?
- How to display the categories on page using shortcode?
- Shortcode conflicts
- 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
- How to create ShortCode
- Images not found after migrating WordPress website
- How to display the specific post content by using POST ID
- How to output functions from plugin inside theme
- add_filter img_caption_shortcode not implemented
- shortcode tags not working in do_shortcode
- How to submit/upload data to database and in specific folder?
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- Get audio metadata on file upload
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- How to list all images used on a specific page?
- How to insert HTML/CSS/JS into my iframe plugin?
- Screenshots on plugin page taken old [closed]
- How do I debug an error that a plugin is causing?