19105, "el-eterno-problema-del-mundo-y-los-hijos"=>19104, "necesitamos-un-pepe"=>19102, "lucas-18-1-8"=>19106, "el-perdon-primero"=>19101, "alabar-a-dios-y-darle-gracias"=>19119, "2-reyes-5-14-17-2-timoteo-2-8-13"=>19123, "creer-en-dios-es-apostar-por-la-vida"=>19132, "lucas-17-5-10"=>19131, "la-gran-evasion"=>19143, ]; $c=get_post(19107)->post_content; $n=0; $report=[]; foreach($map as $badslug=>$dest){ $destUrl=get_permalink($dest); // sustituir el href que contiene /fea// $pat='#https?://[^"]*?/fea/'.preg_quote($badslug,'#').'/#'; $c2=preg_replace($pat,$destUrl,$c,1,$cnt); if($cnt>0){ $c=$c2; $n++; $report[]="OK $badslug -> $destUrl"; } else $report[]="NO ENCONTRADO $badslug"; } wp_update_post(["ID"=>19107,"post_content"=>$c]); echo implode("\n",$report)."\nTotal repuntados: $n/10\n";