<?php
$c=get_post(19112)->post_content;
$map=[
 "el-bautismo-de-jesus-jesus-hijo-del-padre"=>17918, // Galarreta homenaje
 "jean-baptiste-et-son-mouton"=>17990,               // Mardones homenaje
 "nuestra-vida-sea-servicio"=>23519,                 // Mari Patxi fallecimiento
];
$n=0;
foreach($map as $slug=>$id){
  $url=get_permalink($id);
  $pat='#https?://[^"]*?/'.preg_quote($slug,'#').'/#';
  $c2=preg_replace($pat,$url,$c,1,$cnt);
  if($cnt>0){ $c=$c2; $n++; echo "  OK $slug -> $url\n"; } else echo "  NO ENCONTRADO $slug\n";
}
if($n) wp_update_post(["ID"=>19112,"post_content"=>$c]);
// verificar 8 enlaces
preg_match_all('#href="([^"]+)"#',get_post(19112)->post_content,$m);
$ok=0;$bad=0;
foreach($m[1] as $h){ if(preg_match('#/([^/"]+)/?$#',$h,$sm)){ $p=get_posts(["name"=>$sm[1],"post_status"=>"publish","posts_per_page"=>1,"suppress_filters"=>true]); if($p)$ok++; else {$bad++; echo "  ROTO $h\n";} } }
echo "repuntados=$n | enlaces in-memoriam OK=$ok bad=$bad\n";
