// Function to assign Technology category to uncategorized posts
function assign_technology_category_to_uncategorized() {
    global $wpdb;
    
    // Find all uncategorized posts/pages
    $uncategorized = $wpdb->get_results("""
        SELECT p.ID, p.post_type, p.post_title
        FROM {$wpdb->posts} p
        WHERE p.ID NOT IN (
            SELECT tr.object_id
            FROM {$wpdb->term_relationships} tr
            WHERE tr.term_taxonomy_id IN (
                SELECT tt.term_taxonomy_id
                FROM {$wpdb->term_taxonomy} tt
                WHERE tt.taxonomy = 'category'
                AND tt.term_id = 2
            )
        )
        AND p.post_status = 'publish'
        AND p.post_type IN ('post', 'page')
    """);
    
    // Get Technology category term taxonomy
    $technology_tax = $wpdb->get_row("SELECT * FROM {$wpdb->term_taxonomy} WHERE term_id = 2 AND taxonomy = 'category'");
    if (!$technology_tax) {
        return;
    }
    
    $count = 0;
    foreach ($uncategorized as $post) {
        // Check if this post already has the Technology category
        $existing = $wpdb->get_var($wpdb->prepare(
            "SELECT COUNT(*) FROM {$wpdb->term_relationships} WHERE object_id = %d AND term_taxonomy_id = %d",
            $post->ID, $technology_tax->term_taxonomy_id
        ));
        
        if ($existing == 0) {
            $wpdb->insert($wpdb->term_relationships, array(
                'object_id' => $post->ID,
                'term_taxonomy_id' => $technology_tax->term_taxonomy_id,
                'term_order' => 0
            ));
            $count++;
        }
    }
    
    // Log the assignment
    error_log(sprintf('Assigned Technology category to %d uncategorized posts/pages', $count));
}

// Run when theme is activated and when posts are published
add_action('after_setup_theme', 'assign_technology_category_to_uncategorized');
add_action('wp_insert_post', 'assign_technology_category_to_uncategorized', 10, 2);

// Also run on post status update (e.g., when posts are edited)
add_action('transition_post_status', 'assign_technology_category_to_uncategorized', 10, 3);
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://h3rm3s.bid/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://h3rm3s.bid/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://h3rm3s.bid/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://h3rm3s.bid/wp-sitemap-taxonomies-category-1.xml</loc></sitemap></sitemapindex>
