ACF_Admin_Post_type::save_post
Saves post type data.
Метод класса: ACF_Admin_Post_type{}
Хуков нет.
Возвращает
Int
. $post_id
Использование
$ACF_Admin_Post_type = new ACF_Admin_Post_type(); $ACF_Admin_Post_type->save_post( $post_id, $post );
- $post_id(int) (обязательный)
- The post ID.
- $post(WP_Post) (обязательный)
- The post object.
Список изменений
С версии 1.0.0 | Введена. |
Код ACF_Admin_Post_type::save_post() ACF Admin Post type::save post ACF 6.4.2
public function save_post( $post_id, $post ) { if ( ! $this->verify_save_post( $post_id, $post ) ) { return $post_id; } // Disable filters to ensure ACF loads raw data from DB. acf_disable_filters(); // phpcs:disable WordPress.Security.NonceVerification.Missing -- Validated in $this->verify_save_post() above. // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized when saved. $_POST['acf_post_type']['ID'] = $post_id; $_POST['acf_post_type']['title'] = isset( $_POST['acf_post_type']['labels']['name'] ) ? $_POST['acf_post_type']['labels']['name'] : ''; if ( ! acf_get_setting( 'enable_meta_box_cb_edit' ) ) { $_POST['acf_post_type']['register_meta_box_cb'] = ''; $existing_post = acf_maybe_unserialize( $post->post_content ); if ( ! empty( $existing_post['register_meta_box_cb'] ) ) { $_POST['acf_post_type']['register_meta_box_cb'] = $existing_post['register_meta_box_cb']; } } // Save the post type. acf_update_internal_post_type( $_POST['acf_post_type'], $this->post_type ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Validated in verify_save_post // phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized // phpcs:enable WordPress.Security.NonceVerification.Missing return $post_id; }