AnsPress_Comment_Hooks::comment_form()

Description #

Callback for loading comment form.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: includes/comments.php

	public static function comment_form() {
		$comment_id = ap_sanitize_unslash( 'comment', 'r' );
		$_comment = get_comment( $comment_id );

		if ( $_comment ) {
			$_post = ap_get_post( $_comment->comment_post_ID );
		} else {
			$_post = ap_get_post( ap_sanitize_unslash( 'post_id', 'r' ) );
		}

		ob_start();
		ap_comment_form( $_post->ID, $_comment );
		$html = ob_get_clean();

		ap_ajax_json( array(
			'success'     => true,
			'html'        => $html,
			'modal_title' => __( 'Add comment on post', 'anspress-question-answer' ),
		) );
	}

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