Answer to this question actually comes from @TomJNowell. Instead of using mysqlMySQL calls, use the native functions included with WordPress.:
update_post_meta ( $post->ID , 'forum_id', $thread_id );
update_post_meta ( $post->ID , 'forum_id', $thread_id );
where the forum_idforum_id
is the key and the $thread_id$thread_id
is the value. I tried add_post_meta
but that created duplicates.
To retrieve the meta data
$thread_id = get_post_custom_values( 'thread_id', $post->ID);
Now I'm looking at ways to add to the comment meta. Hopefully this helps someone else.