ACF_Form_Post::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 Form Post::save post ACF 6.4.2
public function save_post( $post_id, $post ) {
// Bail early if not 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;
}
}
acf_save_post( $post_id );
// We handle revisions differently on WP 6.4+.
if ( version_compare( get_bloginfo( 'version' ), '6.4', '<' ) && post_type_supports( $post->post_type, 'revisions' ) ) {
acf_save_post_revision( $post_id );
}
return $post_id;
}