ACF_Taxonomy::prepare_post_for_import
Prepares an ACF taxonomy for import.
Метод класса: ACF_Taxonomy{}
Хуков нет.
Возвращает
Массив.
Использование
$ACF_Taxonomy = new ACF_Taxonomy(); $ACF_Taxonomy->prepare_post_for_import( $post );
- $post(массив) (обязательный)
- The ACF post array.
Список изменений
| С версии 6.3.10 | Введена. |
Код ACF_Taxonomy::prepare_post_for_import() ACF Taxonomy::prepare post for import ACF 6.4.2
public function prepare_post_for_import( $post ) {
if ( ! acf_get_setting( 'enable_meta_box_cb_edit' ) && ( ! empty( $post['meta_box_cb'] ) || ! empty( $post['meta_box_sanitize_cb'] ) ) ) {
$post['meta_box_cb'] = '';
$post['meta_box_sanitize_cb'] = '';
if ( ! empty( $post['meta_box'] ) && 'custom' === $post['meta_box'] ) {
$post['meta_box'] = 'default';
}
if ( ! empty( $post['ID'] ) ) {
$existing_post = $this->get_post( $post['ID'] );
if ( is_array( $existing_post ) ) {
$post['meta_box'] = ! empty( $existing_post['meta_box'] ) ? (string) $existing_post['meta_box'] : '';
$post['meta_box_cb'] = ! empty( $existing_post['meta_box_cb'] ) ? (string) $existing_post['meta_box_cb'] : '';
$post['meta_box_sanitize_cb'] = ! empty( $existing_post['meta_box_sanitize_cb'] ) ? (string) $existing_post['meta_box_sanitize_cb'] : '';
}
}
}
return parent::prepare_post_for_import( $post );
}