prefix . 'aitm_systems', $wpdb->prefix . 'aitm_system_locations', $wpdb->prefix . 'aitm_readiness_answers', ); foreach ( $tables as $table_name ) { $found_table = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ) ); if ( $found_table === $table_name ) { $wpdb->query( 'DROP TABLE IF EXISTS `' . esc_sql( $table_name ) . '`' ); } } $post_meta_keys = array( '_aitm_show_badge', '_aitm_ai_usage_status', '_aitm_related_system_id', '_aitm_custom_label_text', '_aitm_public_interest_content', '_aitm_meaningful_human_review', '_aitm_editorial_control', '_aitm_synthetic_media_or_deepfake', '_aitm_provider_marking_status', '_aitm_provider_marking_note', '_aitm_article50_review_note', '_aitm_human_reviewed', '_aitm_badge_type', ); foreach ( $post_meta_keys as $meta_key ) { delete_post_meta_by_key( $meta_key ); } $term_meta_keys = array( 'aitm_show_badge', 'aitm_ai_usage_status', 'aitm_related_system_id', 'aitm_custom_label_text', 'aitm_public_interest_content', 'aitm_meaningful_human_review', 'aitm_editorial_control', 'aitm_synthetic_media_or_deepfake', 'aitm_provider_marking_status', 'aitm_provider_marking_note', 'aitm_article50_review_note', '_aitm_show_badge', '_aitm_ai_usage_status', '_aitm_related_system_id', '_aitm_custom_label_text', 'aitm_human_reviewed', 'aitm_badge_type', ); foreach ( $term_meta_keys as $meta_key ) { $wpdb->delete( $wpdb->termmeta, array( 'meta_key' => $meta_key ), array( '%s' ) ); } delete_option( 'aitm_settings' ); delete_option( 'aitm_version' ); delete_option( 'aitm_db_version' ); delete_option( 'aitm_delete_data_on_uninstall' ); } if ( is_multisite() ) { foreach ( get_sites( array( 'fields' => 'ids', 'number' => 0 ) ) as $site_id ) { switch_to_blog( (int) $site_id ); aitm_uninstall_current_site(); restore_current_blog(); } return; } aitm_uninstall_current_site();