Refer to the parameters section in the documentation for wp_insert_post
.
Custom fields (meta data) must be passed in the form of a key/value array with the parameter name 'meta_input'
.
Change
'post_custom_field' => $add
to
'meta_input' => array( 'post_custom_field' => $add )
To show the value, use the get_post_meta
function. get_post_field
is only for the native fields in the posts
table, not for custom meta data.
echo get_post_meta( get_the_ID(), 'post_custom_field', true );