acf_form_comment::save_comment()publicACF 5.0.0

save_comment

This function will save the comment data

Метод класса: acf_form_comment{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$acf_form_comment = new acf_form_comment();
$acf_form_comment->save_comment( $comment_id );
$comment_id (обязательный)
-

Список изменений

С версии 5.0.0 Введена.

Код acf_form_comment::save_comment() ACF 6.0.4

function save_comment( $comment_id ) {

	// bail early if not valid nonce
	if ( ! acf_verify_nonce( 'comment' ) ) {
		return $comment_id;
	}

	// kses
	if ( isset( $_POST['acf'] ) ) {
		$_POST['acf'] = wp_kses_post_deep( $_POST['acf'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized with wp_kses_post_deep().
	}

	// validate and save
	if ( acf_validate_save_post( true ) ) {
		acf_save_post( "comment_{$comment_id}" );
	}

}