Try this :
function guru20_ReplaceWords($text){
$replace = array('WordPress Codex' => '<a href="http:/codex.wordpress.com">WordPress Codex [EN]</a>',
'WPRecipes'=> '<a href="http://www.wprecipes.com" target="_blank">WPRecipes [EN]</a>',
'f.php' => 'In die Datei functions.php einfügen.');
$text = str_replace_first(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'guru20_ReplaceWords');
add_filter('the_excerpt', 'guru20_ReplaceWords');
function str_replace_first($from, $to, $subject)
{
$from = "https://wordpress.stackexchange.com/".preg_quote($from, "https://wordpress.stackexchange.com/")."https://wordpress.stackexchange.com/";
return preg_replace($from, $to, $subject, 1);
}
You can try with preg_replace