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?
- How to get custom post meta using REST API
- The “_encloseme” Meta-Key Conundrum
- Using get_post_meta with new_to_publish
- Can I count the number of users matching a value in a multiple value key?
- Auto sort the wp-admin post list by a meta key
- get_post_meta() unserialize issue – returns boolean(false)
- Allow user to create instances of custom field
- Get updated meta data after save_post hook
- Save HTML formatted data to post meta using add_post_meta()
- Up/Down voting system for WordPress
- post meta data clearing on autosave
- How to solve slow WordPress site caused by attachment_metadata
- Register new user and add custom data row value for it
- Save attachment custom fields on front end
- Delete all post meta except featured image
- Advice needed for importing custom field data and database structure
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Use ajax to update_post_meta
- 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
- Saving custom image meta fields
- Default WordPress taxonomy (Tag) – How to add a custom field to form and save it to the database
- Get all meta keys assigned to a post type
- Get all posts that do not have a specific custom field without using a subquery
- Combine multiple custom field values into single value
- How to query posts with certain custom meta data, and output Post data
- Custom fields not getting saved in the databse when added to the add new user profile page
- Can’t get post ID using wp_insert_post_data
- WordPress database import: Row size too large
- Custom field not updating when value is empty
- Add post meta fields, when creating a post using WordPress’ REST API
- Store array as single, serialized post meta field or many post meta fields?
- Custom Field Values not updating unless I click “Update” twice
- update_post_meta for repeated custom field [closed]
- Trying to update_post_meta function
- Is there a better way to list all database terms alphabetically?
- get_posts in meta box dropdown not showing latest posts
- Importing Data from a Non-WordPress database, into WP
- Ordering posts by custom field named “date” in backend
- Unique meta_key with array value vs repeated meta_key with single values
- When creating a metabox do you have to create DB fields for the data?
- Allow only one post with specific meta value
- How to validate select field in post meta?
- How to display childrens custom fields?
- how to display custom fields of post on a web page
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- How to fill custom fields with brackets in their key with add_post_meta()?
- change order of images attached to post
- how can I show name and value of Custom Fields together?
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- Gravity Forms Update post meta from template [closed]
- put saved metabox values back into fields and then display on the front end
- How to get custom image field of specific post id
- wpdb function insert doesn’t work
- wordpress multi user question
- How can I change author of posts to the value of one of the custom field of the posts?
- Adding Custom Metadata to my Archive/Posts page
- “BS_” rows in postmeta table
- Saving Custom Field that includes Quotation marks
- Custom Fields Not Showing (ACF not installed)
- Featured image from custom to WordPress database
- Post meta data not showing in frontend, until hitting ‘update’ button
- searching by keywords in post’s metas or pagination links problem
- How do I update custom field post meta in frontend post template?
- How to Find List of Available Custom Fields for Theme?
- update meta field value after
- Custom Fields Not Working In Footer
- ACF plugin and field update
- Echo out custom fields in comments
- Search one custom field?
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- Save values generated via API as custom meta fields
- Adding custom fields to images
- How to save dynamically generated value in post type?
- update_post_meta not working in action hook
- how to show this part only in the single post page?
- Import data from arbitrary CSV to WPAlchemy meta fields
- Display meta data from a custom field within plugin Category Grid View Gallery
- Convert many posts from having a specific meta_key to use a post_format
- If post custom meta data is not set, show normal state
- How do i output images from URL’s added to the same custom field key
- Importing Concrete5 content to WordPress
- custom field with links
- add multiple values (array) to post meta_input
- Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
- How do I load a sql.gz file to my database? (importing)