acf_form_attachment::save_attachment()publicACF 5.0.0

save_attachment

description

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

Хуков нет.

Возвращает

$post_id. (int)

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

$acf_form_attachment = new acf_form_attachment();
$acf_form_attachment->save_attachment( $post, $attachment );
$post (обязательный)
-
$attachment (обязательный)
-

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

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

Код acf_form_attachment::save_attachment() ACF 6.0.4

function save_attachment( $post, $attachment ) {

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

	// bypass validation for ajax
	if ( acf_is_ajax( 'save-attachment-compat' ) ) {
		acf_save_post( $post['ID'] );

		// validate and save
	} elseif ( acf_validate_save_post( true ) ) {
		acf_save_post( $post['ID'] );
	}

	// return
	return $post;
}