Link Kirliliği olmaması açısından sadece yazı içerisinde 1 tane kategoriye link verir.
Veritabanı hızı açısından sorun çıkmamıştır.


<?php
/*
   Plugin Name: Auto Link Categories
   Plugin URI: https://www.r10.net/profil/110992-reckraez.html
   Description: Automatically links to categories when their name appears in post content
   Version: 1.0
   Author: Orkun Akay
   Author URI: https://www.r10.net/profil/110992-reckraez.html
*/
function auto_link_category_in_content( $content ) {
    $linked = false;
    $categories = get_categories( array( 'hide_empty' => false ) );

    foreach ( $categories as $category ) {
        $category_name = $category->name;
        $category_link = get_category_link( $category->term_id );
        
        if ( strpos( $content, $category_name ) !== false && ! $linked ) { 
            $content = str_replace( $category_name, '<a href="' . $category_link . '" title="' . $category_name . ' BURAYA ALT TEXT'TE GÖRÜNMESİNİ VEYA KATEGORİ SONUNDA EKLENMİSİNİ İSTEDİĞİNİZ KELİMEYİ YAZINIZ,YOKSA BOŞ BIRAKABİLİRSİNİZ' . '" style="text-decoration: underline;">' . $category_name . '</a>', $content );
            $linked = true;
        }
    }

    return $content;
}
add_filter( 'the_content', 'auto_link_category_in_content' );