AnsPress_Hooks::delete_comment_subscriptions( integer $comment_id, int|WP_Comment $_comment )

Description #

Delete comment subscriptions right before deleting comment.

Parameters #

  • $comment_id
    integer (Required) Comment ID.
  • $_comment
    int | WP_Comment (Required) Comment object.

Changelog #

VersionDescription
unknown Introducedunknown Introduced
4.1.8Changed event.
4.1.5Introduced.

Source #

File: includes/hooks.php

	public static function delete_comment_subscriptions( $comment_id, $_comment ) {
		$_post = get_post( $_comment->comment_post_ID );

		if ( in_array( $_post->post_type, [ 'question', 'answer' ], true ) ) {
			$type = $_post->post_type . '_' . $_post->ID;
			$row = ap_delete_subscribers( array(
				'subs_event'  => $type,
				'subs_ref_id' => $_comment->comment_ID,
			) );
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment