Proper Prepare Statement for ALTER TABLE and using AFTER

Answer to this question actually comes from @TomJNowell. Instead of using MySQL calls, use the native functions included with WordPress:

update_post_meta ( $post->ID , 'forum_id', $thread_id );

where the forum_id is the key and the $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.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)