Title: wp insert post and custom fields
Last modified: August 19, 2016

---

# wp insert post and custom fields

 *  Resolved [Riccardo Caroli](https://wordpress.org/support/users/beaver82/)
 * (@beaver82)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/)
 * Is it possible to specify custom fields with the function wp insert post?
    in
   the codex it doesn’t specify it
 * [http://codex.wordpress.org/Function_Reference/wp_insert_post#Parameters](http://codex.wordpress.org/Function_Reference/wp_insert_post#Parameters)
 * please help

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/#post-1656096)
 * Retrieve the ID of your newly inserted post and use [add_post_meta](http://codex.wordpress.org/Function_Reference/add_post_meta)
   to give it a custom field
 *  [RIKing](https://wordpress.org/support/users/riking/)
 * (@riking)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/#post-1656376)
 * Would you provide further information
 *  [Henrychester](https://wordpress.org/support/users/henrychester/)
 * (@henrychester)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/#post-1656383)
 * Hi
 * Please someone help
 * I am a newbie at WordPress codex
 * I need to know how can I make visible custom field in my post area section. It
   should be a part of my theme I have uploaded but unfortunately I don’t receive
   support from them.
 * Any help will be appreciated
 * Henry
 *  [Tim Bowen](https://wordpress.org/support/users/creativeslice/)
 * (@creativeslice)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/#post-1656410)
 * Does anyone have an example of using wp_insert_post along with add_post_meta?
   The concept seems pretty clear but I haven’t been able to get it working without
   an example.
 * Thanks in advance! (and if I get it working I’ll post here)
 *  [Tim Bowen](https://wordpress.org/support/users/creativeslice/)
 * (@creativeslice)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/#post-1656411)
 * Found the solution here: [http://wordpress.stackexchange.com/questions/8569/wp-insert-post-php-function-and-custom-fields](http://wordpress.stackexchange.com/questions/8569/wp-insert-post-php-function-and-custom-fields)
 * Basically you just need to add something like this right after wp_insert_post();
 * add_post_meta($post_id, ‘META-KEY-1’, ‘META_VALUE-1’, true);

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘wp insert post and custom fields’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 5 participants
 * Last reply from: [Tim Bowen](https://wordpress.org/support/users/creativeslice/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/wp-insert-post-and-custom-fields/#post-1656411)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
