ACF_Form_Post::save_post()publicACF 1.0.0

save_post

Triggers during the save_post to save the $_POST data.

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

Хуков нет.

Возвращает

int.

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

$ACF_Form_Post = new ACF_Form_Post();
$ACF_Form_Post->save_post( $post_id, $post );
$post_id(int) (обязательный)
The post ID
$post(WP_POST) (обязательный)
the post object.

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

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

Код ACF_Form_Post::save_post() ACF 6.0.4

function save_post( $post_id, $post ) {

	// bail early if no allowed to save this post type
	if ( ! $this->allow_save_post( $post ) ) {
		return $post_id;
	}

	// verify nonce
	if ( ! acf_verify_nonce( 'post' ) ) {
		return $post_id;
	}

	// validate for published post (allow draft to save without validation)
	if ( $post->post_status == 'publish' ) {

		// bail early if validation fails
		if ( ! acf_validate_save_post() ) {
			return;
		}
	}

	// save
	acf_save_post( $post_id );

	// save revision
	if ( post_type_supports( $post->post_type, 'revisions' ) ) {
		acf_save_post_revision( $post_id );
	}

	// return
	return $post_id;
}