publish ?? 0; echo "\nExisting profiles: $existing_profiles\n\n"; echo "=== Running Enhanced Import ===\n"; $start_time = microtime(true); try { $results = execute_enhanced_csv_import(); $end_time = microtime(true); $execution_time = round($end_time - $start_time, 2); echo "\n=== Import Results ===\n"; echo "Execution time: {$execution_time} seconds\n"; echo "Total rows: " . ($results["total_rows"] ?? 0) . "\n"; echo "Users created: " . ($results["users_created"] ?? 0) . "\n"; echo "Users updated: " . ($results["users_updated"] ?? 0) . "\n"; echo "Profiles created: " . ($results["profiles_created"] ?? 0) . "\n"; echo "Profiles updated: " . ($results["profiles_updated"] ?? 0) . "\n"; echo "Taxonomies assigned: " . ($results["taxonomies_assigned"] ?? 0) . "\n"; echo "Venues created: " . ($results["venues_created"] ?? 0) . "\n"; echo "Organizers created: " . ($results["organizers_created"] ?? 0) . "\n"; echo "Errors: " . ($results["errors"] ?? 0) . "\n"; if (isset($results['fatal_error'])) { echo "\n❌ Fatal Error: " . $results['fatal_error'] . "\n"; } // Verification $new_profile_count = wp_count_posts("trainer_profile")->publish ?? 0; echo "\nTotal profiles after import: $new_profile_count\n"; // Check first few imported profiles with their taxonomy data $profiles = get_posts([ "post_type" => "trainer_profile", "posts_per_page" => 5, "orderby" => "date", "order" => "DESC" ]); echo "\n=== Sample Imported Profiles ===\n"; foreach ($profiles as $profile) { echo "- " . $profile->post_title . " (ID: " . $profile->ID . ")\n"; // Check profile meta $email = get_post_meta($profile->ID, 'trainer_email', true); $phone = get_post_meta($profile->ID, 'trainer_phone', true); $company = get_post_meta($profile->ID, 'company_name', true); echo " Email: $email\n"; echo " Phone: $phone\n"; echo " Company: $company\n"; // Check taxonomy assignments $business_terms = get_the_terms($profile->ID, "business_type"); if ($business_terms && !is_wp_error($business_terms)) { $business_names = wp_list_pluck($business_terms, "name"); echo " Business Type: " . implode(", ", $business_names) . "\n"; } $audience_terms = get_the_terms($profile->ID, "training_audience"); if ($audience_terms && !is_wp_error($audience_terms)) { $audience_names = wp_list_pluck($audience_terms, "name"); echo " Training Audience: " . implode(", ", $audience_names) . "\n"; } echo "\n"; } echo "✅ Enhanced CSV import completed successfully!\n"; } catch (Exception $e) { echo "❌ Import failed: " . $e->getMessage() . "\n"; echo "Stack trace:\n" . $e->getTraceAsString() . "\n"; } ?>