ACF\Site_Health

Site_Health::pre_update_acf_internal_cptpublicACF 6.3

Adds events when ACF internal post types are created.

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

Хуков нет.

Возвращает

Массив.

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

$Site_Health = new Site_Health();
$Site_Health->pre_update_acf_internal_cpt( $post ): array;
$post(массив)
The post about to be updated.
По умолчанию: array()

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

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

Код Site_Health::pre_update_acf_internal_cpt() ACF 6.4.2

public function pre_update_acf_internal_cpt( array $post = array() ): array {
	if ( empty( $post['key'] ) ) {
		return $post;
	}

	$post_type = acf_determine_internal_post_type( $post['key'] );

	if ( $post_type ) {
		$posts = acf_get_internal_post_type_posts( $post_type );

		if ( empty( $posts ) ) {
			$post_type = str_replace(
				array(
					'acf-',
					'-',
				),
				array(
					'',
					'_',
				),
				$post_type
			);
			$this->add_site_health_event( 'first_created_' . $post_type );
		}
	}

	return $post;
}