: array { $counts = array( 'field_groups' => 0, 'post_types' => 0, 'taxonomies' => 0, ); // Count AI-ready field groups. foreach ( $field_groups as $field_group ) { if ( ! empty( $field_group['allow_ai_access'] ) && ! empty( $field_group['active'] ) ) { ++$counts['field_groups']; } } // Count AI-ready post types. foreach ( $post_types as $post_type ) { if ( ! empty( $post_type['allow_ai_access'] ) && ! empty( $post_type['active'] ) ) { ++$counts['post_types']; } } // Count AI-ready taxonomies. foreach ( $taxonomies as $taxonomy ) { if ( ! empty( $taxonomy['allow_ai_access'] ) && ! empty( $taxonomy['active'] ) ) { ++$counts['taxonomies']; } } return $counts; } /** * Get the usage metrics for Site Health display. * * @since 6.8.0 * * @return array The usage metrics. */ public function get_usage_metrics(): array { $site_health = $this->site_health->get_site_health(); if ( ! isset( $site_health['ai_usage'] ) ) { return array( 'total_discovery_hits' => 0, 'total_executions' => 0, 'error_count' => 0, ); } $usage = $site_health['ai_usage']; return array( 'total_discovery_hits' => $usage['total_discovery_hits'] ?? 0, 'total_executions' => $usage['total_executions'] ?? 0, 'error_count' => $usage['error_count'] ?? 0, 'executions_by_ability' => $usage['executions_by_ability'] ?? array(), ); } }