Add meta data field to a post.

Post meta data is called “Custom Fields” on the Administration Screen.

Signature

add_post_meta( $post_id, $meta_key, $meta_value, $unique = false )
post_id
 (int) Post ID.
meta_key
 (string) Metadata name.
meta_value
 (mixed) Metadata value. Must be serializable if non-scalar.
unique
 (boolean) Optional. Whether the same key should not be added. Default false.
Default: false

Return

(int|boolean) Meta ID on success, false on failure.

Source

function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
	// Make sure meta is added to the post, not a revision.
	if ( $the_post = wp_is_post_revision($post_id) )
		$post_id = $the_post;

	return add_metadata('post', $post_id, $meta_key, $meta_value, $unique);
}
WP Trac GitHub

Link here