you need to get the ID back from your post insertion and use that with add_post_meta
:
$post_id = wp_insert_post($post);
add_post_meta($post_id, 'thumbnail', $yourvalue, true);
Related Posts:
- So much data in postmeta
- What is the advantage of the wp_options design pattern?
- Remove old custom field after import
- Move value of one custom field to another
- Importing users to Buddypress with custom fields
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- MySQL query to set wp_postmeta using term_taxonomy_id value
- MySQL Query that looks for post with Custom Field, then changes Category
- Unique Post Meta Values
- Add custom field to all posts in specific post_type
- How to improve my non-unique metadata MySQL entries?
- Why is my database import losing text widget data?
- Can I exclude a post by meta key using pre_get_posts function?
- Custom post meta field effect on the performance on the post
- How to get custom post meta using REST API
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- What is the index [0] for on post meta fields?
- What is “meta_input” parameter in wp_insert_post() used for?
- How to enable revisions for post meta data?
- The “_encloseme” Meta-Key Conundrum
- Best way to programmatically remove a category/term from a post
- Importing data for advanced custom fields plugin?
- How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?
- Using get_post_meta with new_to_publish
- Custom field metabox not showing in back-end
- Can I count the number of users matching a value in a multiple value key?
- When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
- How to hide meta box values from custom fields list?
- Auto sort the wp-admin post list by a meta key
- With WordPress Importer, why can’t I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?
- get_post_meta() unserialize issue – returns boolean(false)
- Storing meta fields multiple times OR once with multi dimensional array?
- Allow user to create instances of custom field
- display specific custom fields
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- Edit Custom Database Tables in WordPress
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- passing argument to get_template_part() or a better way to code
- Is it possible to store arrays in a custom field?
- Get updated meta data after save_post hook
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- Save HTML formatted data to post meta using add_post_meta()
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- Query meta field using between
- How to delete custom field “suggestions” from dropdown list
- Create meta boxes that don’t show in custom fields
- Transients vs CRON +Custom Fields: Caching Data Per Post
- Unable to save datetime custom meta field using update_post_meta() function
- Up/Down voting system for WordPress
- post meta data clearing on autosave
- Create custom field on post draft or publish?
- Display info from custom fields in all images’ HTML
- How to solve slow WordPress site caused by attachment_metadata
- Register new user and add custom data row value for it
- Ordering posts by anniversary using only day and month
- get_post_meta fields don’t show up on posts page
- Update meta values with AJAX
- How to break meta values into different items and avoid duplicates?
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- ajax delete value from custom field array
- Save attachment custom fields on front end
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- Front-end update_post_meta with ajax
- Delete all post meta except featured image
- How to use pagination with get_post_meta
- Copying Custom Meta Values from existing post to a duplicate post
- Add a post meta key and value only if it does not exist on the post
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Order posts according to user defined order for meta values?
- Displaying posts with only upcoming dates according their custom field date value
- Advice needed for importing custom field data and database structure
- Programatically import custom fields using wp all import [closed]
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Custom fields to save multiple values
- Custom fields: In what order are they saved into the DB?
- Function to change meta value in database for each post
- Get a post_id where meta_value equals something in a serialized meta_value field
- MySQL Syntax Error upon restoring database from backup [closed]
- Get multiple custom field values in a $wpdb query [duplicate]
- Use ajax to update_post_meta
- Get aggregate list of all custom fields for entire blog
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Custom field value based on other custom field values
- little help with a mySQL query to wp database
- Leader board for game on homepage
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- How to save a ToggleControl value in a meta field?
- Saving custom image meta fields
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Default WordPress taxonomy (Tag) – How to add a custom field to form and save it to the database
- How to display Meta Field Value?
- Separate table or usermeta
- Delete all post meta except featured image Using SQL
- How to Validate Post Meta type/extension (Video File Image File etc)
- Custom User Profile Fields