In order to add a new value and keep the previous values, you need to use add_post_meta()
instead of update_post_meta()
:
$post_id = get_the_ID();
$new_post_desc="the new value here";
// add_post_meta() add a new field with the same name
// and keeps previous values on the database
add_post_meta( $post_id, 'post_desc', $new_post_desc );
Then, you can use get_post_custom_values()
to get all values for post_desc
field, but note that you are using this function incorrectly.
Instead of:
$values = get_post_custom_values(get_the_ID(), $post_desc);
It should be:
$values = get_post_custom_values( 'post_desc', get_the_ID() );
where 'post_desc'
(not $post_desc
) is the name or the field.
If you want to update one specific value previously set for that field, you can use update_post_meta()
passing the previous value you want to update as the fourth parameter:
update_post_meta( $post_id, 'post_desc', 'new_value', 'previous_value' );