This code will do the job:
function apt_new_comment_tagging($post_id){
$article_id = get_comment($post_id);
apt_single_post_tagging($article_id->comment_post_ID);
}
add_action('comment_post', 'apt_new_comment_tagging');
The whole thing should look similar to this:
function apt_new_comment_tagging($post_id){
$article_id = get_comment($post_id);
apt_single_post_tagging($article_id->comment_post_ID);
}
if($apt_settings['apt_tagging_hook_type'] == 1){
add_action('comment_post', 'apt_new_comment_tagging');
// add_action('publish_post','apt_single_post_tagging'); //executes the tagging script after publishing a post
}
else{ //trigger tagging when saving the post
add_action('save_post','apt_single_post_tagging'); //executes the tagging script after saving a post
}
In this case, the post won’t be tagged when published, only when a new comment is made. (Every time someone adds a comment, the tagging function will process the post. You may want to a avoid that by adding a condition that executes the code only if no comment has been added yet.)