function add_all_categories_to_posts() {
    // Tüm kategorileri al
    $categories = get_categories( array(
        'hide_empty' => 0,
    ));

    // Kategori ID'lerini bir diziye kaydet
    $category_ids = array();
    foreach ( $categories as $category ) {
        $category_ids[] = $category->term_id;
    }

    // Tüm yazıları al
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => -1, // Tüm yazıları al
        'post_status' => 'publish'
    );
    $posts = get_posts( $args );

    // Her yazı için tüm kategorileri ekle
    foreach ( $posts as $post ) {
        wp_set_post_categories( $post->ID, $category_ids, false );
    }
}
add_action( 'init', 'add_all_categories_to_posts' );