Disable comment syncing when comments are closed on a post

This commit is contained in:
Jeremy Dormitzer 2018-10-29 06:21:27 -04:00
parent 613de14233
commit ec9cbe8364

View File

@ -149,6 +149,9 @@ function sync_comments( $activity ) {
if ( ! $parent_comment ) {
return;
}
if ( ! \comments_open( $parent_comment->comment_post_ID ) ) {
return;
}
$comment = make_comment_from_object( $object, $parent_comment->comment_post_ID, $parent_comment_id );
$comment_id = \wp_new_comment( $comment );
link_new_comment( $comment_id, $object_id );
@ -163,6 +166,9 @@ function sync_comments( $activity ) {
if ( $post_id === 0 ) {
return;
}
if ( ! \comments_open( $post_id ) ) {
return;
}
$comment = make_comment_from_object( $object, $post_id, $parent_comment_id );
$comment_id = \wp_new_comment( $comment );
link_new_comment( $comment_id, $object_id );