ACF\Site_Health
Site_Health::pre_update_acf_internal_cpt
Adds events when ACF internal post types are created.
Method of the class: Site_Health{}
No Hooks.
Returns
Array.
Usage
$Site_Health = new Site_Health(); $Site_Health->pre_update_acf_internal_cpt( $post ): array;
- $post(array)
- The post about to be updated.
Default:array()
Changelog
| Since 6.3 | Introduced. |
Site_Health::pre_update_acf_internal_cpt() Site Health::pre update acf internal cpt code ACF 6.8.8
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;
}